You are given an array $$$a$$$ of size $$$n$$$, and an integer $$$r$$$.
Your task is to find a binary tree of size $$$n$$$ satisfying:
You need to output the In-order Traversal sequence of this binary tree. If there can be multiple possible answers, output any. If there is no such binary tree, output $$$-1$$$ instead.
The first line of input contains $$$t$$$, the number of test cases $$$(1\le t\le 10^4)$$$.
For each testcase:
The sum of $$$n$$$ over all test cases doesn't exceed $$$2\cdot10^5$$$.
For each test case, you have to output a sequence of $$$n$$$ integers — the In-order Traversal sequence of this binary tree. Since there can be multiple possible answers, output any. If there is no such tree, output $$$-1$$$ instead.
4 5 1 2 2 3 3 5 4 1 1 2 3 4 4 2 4 4 4 4 2 2 2 1
5 1 4 3 2 3 2 4 1 2 3 1 4 -1
In the first test case, the binary tree is as follows:
We can see that node $$$1$$$ is the root and for each testcase:
In the fourth test case, it can be shown that there exists no valid binary tree.