D - Basic Basis
题号:NC223989
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

You are given a sequence of  bit strings , each with  bits. You are also given another sequence of  bit strings a_1, a_2, . . . , a_m, each also with bits.
Let  denote the minimum index  such that it is possible to take a non-empty subset of , XOR them all together, and get . If there is no such index, .
Print the values f(a_1), f(a_2), . . . , f(a_m).

输入描述:

The first line of input contains three integers  and , where  is the length of sequence  is the length of sequence , and the elements of both sequences are bit strings with  bits.
Each of the next  lines contains a hexadecimal representation of b_i as a string of length . The strings consist only of hexadecimal digits ( and ). 
Then, each of the next  lines contains a hexadecimal representation of  in the same format as
above.

输出描述:

Output  lines with a single integer on each line, where the integer on the th line is .
示例1

输入

复制
3 5 2
02
e1
fa
02
e3
1b
e1
ff

输出

复制
1
2 
3 
2
-1
示例2

输入

复制
5 6 2 
01 
02 
04 
08 
10 
01 
02 
03 
04 
05
64

输出

复制
1 
2 
2 
3 
3
-1