# Indiana Jones and the cryptic code SOLUTIONS ECAUG208

Page Contents

### Indiana Jones and the cryptic code SOLUTIONS

Indiana Jones has at last discovered Atlantis and he likewise found a few compositions that can decode Atlantean language. Abnormally Atlantean language letter sets are equivalent to English language letters in order. The Atlantean composition contains N special words. (numbered from 1).

Indiana has likewise found a gadget that shows a solitary letter set for each second for an aggregate of Q seconds. At each second, Indiana attempts to make sense of if the string shaped by a portion of the back to back letters in order appeared by the gadget up to that point, spell any of the word present in the rundown. In the event that he finds a word, he prints F(String)

where,

F(String) is 0, if the position(string) in original copy is odd, and it is 1, if the position(string) in composition is even.

at each subsequent Indiana can discover numerous words from the rundown wherein case, shorter words get their f(string) determined first.

Note: a word comprising of q(i… … j) can be taken just a single time. On the off chance that a similar word is found in another position, at that point it tends to be added to yield once more.

Information:

First line will contain N, number of words in the rundown.

The following line will contain N space isolated words.

The following line contains Q speaking to the quantity of letter sets let out by the machine

The accompanying Q lines will each have a solitary letter set.

Yield:

Yield the string that speaks to the message. Its is ensured that at any rate 1 word will be found

Requirements

1≤N≤10000

1≤|word|≤100

1≤Q≤106

Every q is a solitary lowercase english letter set.

Kindly utilize quick I/O to take input.

Test Input:

Test experiment 1:

abc ced

10

Test experiment 2:

babc abc

Test Output:

Test experiment 1:

01

Test experiment 2:

10

Clarification:

In the primary model, word ‘abc’ and ‘ced’ was there in the rundown of letter sets let out. Consequently yield 01.