You are given a sequence of n bit strings b_1,b_2,…,b_n, each with k×4 bits.
You are also given another sequence of m bit strings a_1,a_2,…,a_m, each also with k× 4 bits.
Let f(x) denote the minimum index i such that it is possible to take a non-empty subset of b_1,b_2,…,b_i , XOR them all together, and get x. If there is no such index, f(x)=−1.
Print the values f(a_1),f(a_2),…,f(a_m).
The first line of input contains three integers n (1≤n≤1,000), m (1≤m≤1,000) and k (1≤k≤40), where n is the length of sequence b, m is the length of sequence a, and the elements of both sequences are bit strings with k×4 bits.
Each of the next n lines contains a hexadecimal representation of b_i as a string of length k. The strings consist only of hexadecimal digits (‘0’–‘9’ and ‘a’–‘f’).
Then, each of the next m lines contains a hexadecimal representation of a_i in the same format as above.
Output m lines with a single integer on each line, where the integer on the ith line is f(a_i).