You have $$$n$$$ items in a vertical stack, the color of the $$$i$$$-th item from the top is $$$c_i$$$.
You need to process $$$q$$$ queries on this stack. In each query, you'll be given a color $$$d$$$ and you need to —
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n \le 10^5$$$; $$$1 \le q \le 10^5$$$) — the number of items in the stack and the number of queries.
The second line of each test case contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le n$$$) — colors of the items.
The third line of each test case contains $$$q$$$ integers $$$d_1, d_2, \dots, d_q$$$ ($$$1 \le d_i \le n$$$) — colors in the queries.
It is guaranteed that the sum of $$$n$$$ over all test cases doesn't exceed $$$10^5$$$ and the sum of $$$q$$$ doesn't exceed $$$10^5$$$. Also, for every $$$d_i$$$ in the queries, there is at least one item in the stack with color $$$d_i$$$.
For each test case, output $$$q$$$ lines containing the answers to the corresponding queries.
17 52 1 1 4 3 3 13 2 1 1 4
5 2 3 1 5
| Название |
|---|


