



The order of elements within the lists doesn’t matter.
The first line of the input contains ‘T’ denoting the number of test cases.
The first line of each test case contains the elements of the tree in the level order form separated by a single space.
The second contains each test case contains an integer ‘K’ denoting the number of elements in the ‘delNodes’ array.
The third line of each test case contains K space-separated integers which are the elements to deleted from the tree.
In the first line values of nodes separated by a single space. In case a node is null, we take -1 in its place.
For example, the level order input for the tree depicted in the above image would be :
15
40 62
-1 -1 10 20
-1 -1 -1 -1
Level 1 :
The root node of the tree is 15.
Level 2 :
Left child of 15 = 40
Right child of 15 = 62
Level 3 :
Left child of 40 = null (-1)
Right child of 40 = null (-1)
Left child of 62 = 10
Right child of 62 = 20
Level 4 :
Left child of 10 = null (-1)
Right child of 10 = null (-1)
Left child of 20 = null (-1)
Right child of 20 = null (-1)
The above format was just to provide clarity on how the input is formed for a given tree.
The sequence will be put together in a single line separated by a single space. Hence, for the above-depicted tree, the input will be given as:
15 40 62 -1 -1 10 20 -1 -1 -1 -1
For each case just return the list of pointers to the root nodes of disjoint trees,
1 <= T <= 5
1 <= N <= 3000
1 <= K <= N
0 <= Node Data <= 5000
Time Limit: 1sec