Given a dictionary containing less than N = 20000 words labeled from 1 to N. Each word consists of lowercase characters (from 'a' to 'z') with arbitrary length. The total number of characters in the dictionary is at most 100,000. Your task is to answer at most Q = 100000 queries. Each query qi is also a word (as defined above). For each query, you have to print the "Top 10" words in the dictionary with the following rules:
The first line contains the number N. The next N lines contains the N words in the dictionary (the ith line is the word with label i). The next line contains the number Q followed by the Q lines containing the queries.
For each query, print one line containing the labels of the "Top 10" words (separated by a space) in the dictionary using the rules defined above.