Question
Sort it
You are given arrays A and B of sizes N and M respectively, such that 1 ≤ Bi ​≤ N. For each 1 ≤ i ≤ M.  Sort the suffix of length Bi in array A in non-decreasing order.
Output the resultant array A after all operations. Note that a suffix of length X denotes the subarray consisting of last X elements of the array.
Input
The first line consists of a single integer T, denoting the number of test cases.
The first line of each test case consists of two space-separated integers N and M, denoting the sizes of arrays A and B.
The second line of each test case consists of N space separated integers, denoting an array A.
The third line of each test case consists of M space separated integers, denoting an array B.

Constraints
1 ≤ T ≤ 103
1 ≤ N, M ≤ 103
1 ≤ Ai ≤ 107
1 ≤ Bi ≤ N
Output
For each test case, output N space-separated integers, denoting the resultant array A after all operations.
Example
Sample Input
1
5 1
2 3 4 6 1
2
Sample Output
2 3 4 1 6
Explanation
Initially A = [2, 3, 4, 6, 1]. After sorting the suffix of length 2, the array changes to A = [2, 3, 4, 1, 6].

Online