You are given an n-ary tree (not necessarily binary) and a list of node IDs to delete. When a node is deleted, it is removed from the tree but its children are NOT deleted — instead, all of its children are promoted and become direct children of the deleted node's…