gendalf-lost
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Gandalf the Grey is in trouble fighting Saruman the White .
With his magical powers, Saruman has escorted Gandalf to an abandoned forest. 
Gandalf roams in the forest seeking rescue, when he finds an old wizard- the Guard of the forest. 
The wizard agrees to rescue Gandalf only on one condition. Gandalf must solve a string problem for the wizard. 
Given a list L of N words the wizard asks  Q Queries .
Each Query contains a word W. 

If W belongs to the list then find the lexicographical index of the word in the list.
If W does not belong to the list then answer -1

Now Gandalf is a magical Wizard. Unlike you he has no idea what strings are. So he seeks your help. The guard wont spare the life of Gandalf for any wrong answer. 
 
Note: 
 By lexicographical ordering we mean the alphabetical ordering of strings as in a dictionary.
        
        0 < 9
        9 < A
        A < Z
        ABH < ABHI
        List comprises N distinct words.
Input

The first line of the input contains an integer N, the number of words in the list L.
Then follow N lines each containing  a word of the list L.
The next line contains an integer Q the number of "Queries" 
Then follow Q lines each containing a word W.

Output

For each Query output a single integer in a separate line, the answer for the corresponding Query.

Constraints
1 ≤ N ≤ 10^6
1 ≤ Q ≤ 10^6
2 ≤ length(W) ≤ 10
A word comprises  : digits  0,1,2...9   &  alphabets A-Z  and nothing else. Their is no space in a word.

SAMPLE INPUT
2
SAURON 
SARUMAN
4
SARUMAN
SAURON
GANDALF
FRODO

SAMPLE OUTPUT
1
2
-1
-1