Mark has an array, A of N elements. He performs Q queries in it. In each query, he chooses an index I(0- based) and does the following:
for j = I + 1 to N:
if A[j] < A[I]:
A[j] = 0
You need to print what array A looks like after processing all the Q queries.
Note : The queries are not independent of each other i.e. you need to use the changed array A, for each query.
Constraints
1≤T≤10
1≤N≤105
1≤Ai≤109
1≤Q≤105
Input
The first line of input has an integer T, denoting the number of test cases. Each test case will consist of 3 lines, the first line contains 2 space seperated integers, N and Q, denoting the number of elements in the array and number of queries.
2nd line will have N space separated integers denoting the elements in the initial array A .
3rd line will have Q space separated integers denoting the chosen index in the each query.
Output
For each test case, output in a seperate line, N space separated integers denoting the final array A .
Hint: Use an advanced sorting algorithm.
In the first test case :
Array after 1st query : {4,3,4,3,0}
Array after 2nd query : {4,3,4,0,0}