#000557

Decode

Data travels through computer networks as a sequence of bits. In order to know how to read received message, the recipient has to have information about the way characters are recorded. One possible way is to choose a fixed number of bits, say K, and to assign each character a number between 0 and 2^{K - 1}. Advantage of using such a method is that recipient knows that every number is represented with exactly K bits and so they can easily determine all the characters. But this method has a drawback - even small numbers require K bits and so the process of transmission lasts longer than it might. That's why data compression is used.


One way to compress data is allowing character records to have different bit lengths. Characters appearing more often in the message get assigned shorter numbers and those which appear rarely get assigned longer numbers. It is necessary that each character gets assigned a record which is NOT a prefix of some other character's record (otherwise one might not know whether to stop reading bits and print the character or continue and print some other character).


Your task is to write a decoder of a message compressed in the way described above, provided you've been given a code table.



InputIn the first row there is a natural number N ( 1 \leq N \leq 80), number of different characters in the message. Next N rows each contain a character and its binary record, separated with a space character. Binary records will not contain more than 80 bits and all characters will be standard ASCII characters above 32 (no whitespace characters will appear). The next row contains the encoded message, whose length will not exceed 10 MB. All character records will be valid. That is, no record will be a prefix of some other record.


OutputIn the first and only row of the output, print the original message.


Input
5
A 0000
! 0001
c 001
D 01
e 1
00000001001100101

Output
A!cecD


Input
5
a 110
b 111
c 00
. 01
e 10
11010011110011010

Output
ae.bcae

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.