T9

Time limit1sMemory limit128 MB

Problem

T9 is a system developed to satisfy the rapidly growing need to quickly send text messages (SMS) on mobile phones. It works from a dictionary stored in the phone's memory. While typing a word it is enough to press one key for each letter. The first word in the dictionary that matches the letters corresponding to the pressed keys is then displayed.

The arrangement of letters on a mobile phone keypad is given in the following table.

123456789
spaceA B CD E FG H IJ K LM N OP Q R ST U VW X Y Z

A message is a sequence of words separated by single spaces. Write a program that simulates the T9 system for a given dictionary.

Input

The first line contains a natural number M (1 ≤ M ≤ 100), the number of words in the dictionary. Each of the next M lines contains one dictionary word. The words are sorted in ascending order. Each word consists only of capital letters of the English alphabet (A–Z) and has length at most 100.

The (M+2)-th line contains a natural number N (1 ≤ N ≤ 100), the number of key presses.

The following line contains N natural numbers from the set {1, 2, …, 9}, separated by single spaces, the numbers of the pressed keys.

Output

Print the message produced by the T9 system on a single line. Each letter of a word that is not in the dictionary is replaced by a * character. If more than one word matches a sequence of pressed keys, the first such word is chosen.