#Qua2201. Bitwise Password

Bitwise Password

Description

Libra wrote down an array of non-negative integers a1,a2,,ana_1,a_2,\dots, a_n. For each continuous subsequence {al,al+1,,ar}\{a_l,a_{l+1},\dots,a_r\} of the array, Libra can calucate its bitwise-xor sum: $a_l\;\mathrm{xor}\;a_{l+1}\;\mathrm{xor}\;\dots \;\mathrm{xor}\; a_r$. (xor represents ^ in C/C++)

Libra gives you mm queries, each of which is described by an integer xix_i. For each query, you need to find a continuous subsequence with minimum value of xiR|x_i-R|, where RR is the bitwise-xor sum of the subsequence. You should tell Libra the length of the corresponding sequence.

If there are multiple subsequences that meet the conditions, tell Libra the longest length of these subsequences.

Format

Input

The first line contains one integer T(1T100)T(1\le T\le 100) --- the number of test cases.

Each test case consists of two lines.

The first line contains N+1N+1 non-negative integers. The first number is N(1N100)N(1\le N\le 100) --- the length of the array. The next NN numbers describe the array {ai}\{a_i\} Libra wrote down.(ai1024)(a_i\le 1024)

The first line contains M+1M+1 integers. The first number is M(1M100)M(1\le M\le 100) --- the number of queries. The next MM numbers xi(xi1024)x_i(|x_i|\le 1024) describe the queries.

Output

For each test case, print M+1M+1 lines. The first MM lines contains the answer to the MM queries, and the (M+1)(M+1)-th line left empty.

Samples

2
2 1 1
2 0 2
3 1 2 4
3 10 5 1
2
1

3
2
1