Memory Master

Time limit2sMemory limit256 MB

Problem

Yeonjong says he can remember every integer he sees in a day. To check this, Donggyu wrote all integers Yeonjong saw in Notebook 1. Then Donggyu asked M questions. Each question is: 'Have you seen the integer X today?' Notebook 2 records, in order, the integers that Yeonjong said he had seen.

For each integer written in Notebook 2, write a program that prints 1 if it appears in Notebook 1 and 0 otherwise.

Input

The first line contains the number of test cases T. For each test case, the first line contains N (1 <= N <= 1,000,000), the number of integers in Notebook 1. The next line contains the N integers in Notebook 1. Then a line contains M (1 <= M <= 1,000,000), the number of integers in Notebook 2. The next line contains the M integers in Notebook 2.

Every integer is within the int range.

Output

For each test case, in the order of the integers in Notebook 2, print 1 if the integer is in Notebook 1 and 0 otherwise, one result per line.