

First-line contains ‘T’, denoting the number of Test cases.
For each Test case:
The first line contains an integer ‘N’, denoting the number of nodes in the BT.
The following line will contain the values of the tree’s nodes in the level order form ( -1 for 'NULL' node). Refer to the example for further clarification.
The next line contains 'N' space-separated integers denoting the array 'A'.
5 → represents the total number of nodes.
1 2 3 -1 -1 4 5 -1 -1 -1 -1 → represents the level order of Tree.
Explanation :
Level 1 :
The root node of the tree is 1.
Level 2 :
The left child of 1 = 2.
The right child of 1 = 3.
Level 3 :
The left child of 2 = null (-1)
The right child of 2 = null (-1)
The left child of 3 = 4
The right child of 3 = 5
Level 4:
The left child of 4 = null (-1)
The right child of 4 = null (-1)
The left child of 5 = null (-1)
The right child of 5 = null (-1)
For each test case, print all the nodes you want to flip. You can print the nodes in any order. The total number of nodes must be minimum. If it is impossible to flip the nodes in the tree to make the pre-order traversal match A, Print -1.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 5
1 <= ‘N’ <= 10^5
Note- the sum of ‘N’ over all test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm: