###description You a given a permutation of size n. Initially, all elements in p are frozen. There will be n stages that these elements will become available one by one. On stage i, the element will become available.
For each i, find the longest increasing subsequence among available elements after the first i stages.
###input The first line of the input contains an integer T(1≤T≤3), denoting the number of test cases.
In each test case, there is one integer n(1≤n≤50000) in the first line, denoting the size of permutation.
In the second line, there are n distinct integers , denoting the permutation.
In the third line, there are n distinct integers , describing each stage.
It is guaranteed that and are generated randomly.
###output For each test case, print a single line containing n integers, where the i-th integer denotes the length of the longest increasing subsequence among available elements after the first i stages.