There are 'N' people standing in a Queue. You are given the height of each person and the number of people who are taller and standing ahead of him. You have to find the position of each person.
First line contains a single integer T, the number of test cases. Each test case has 3 lines, first line contains a single integer N. Second line contains N integer which are the heights of N people in the queue. Third line also contains N integers which is the number of people standing ahead of him.
Output one line for each test case which contains the heights of the people in the order in which they are standing in the Queue. All heights should be separated by a single space.
1 <= T <= 100
1 <= N <= 10000 (This is the only difference between Rookie and Pro versions of the problem).
1 <= Height <= 10^7
0 <= No of taller people standing ahead < N
All heights are distinct.
Expected Time Complexity : O(NlogN)
33 11 22 44 55
0 2 1 1 0
33 22 11 55 44
Problem Setter : Shikhar Sharad
Problem Tester : Arjun Singh Bhatia
Problem Source : Directi Interview