Oleh and Ihor are playing spies. The main goal of the game is to exchange secret messages while maintaining secrecy. For this, Oleh and Ihor use a special cipher.
The encryption and decryption method is very simple: each letter of the Cyrillic alphabet is mapped to a certain sequence of Latin letters p_{\alpha}. Then, in the message, every occurrence of each is replaced by its corresponding p_{\alpha}. To further confuse a potential adversary, Oleh and Ihor have agreed that only the lexicographically minimal word in the original message should matter. Recall that a string is lexicographically less than a string if there exists an such that for every j < i the equality a_j = b_j holds and a_i < b_i, or the string is a prefix of the string .
Recently, Oleh proposed to Ihor to use the following letter transformation table:
Now, Ihor cannot decrypt Oleh's messages in time, and asks you to help him: determine the number of the word which, before encryption (written with Cyrillic letters), was lexicographically minimal.
The first line contains a single integer (1 \leq n \leq 1000) — the number of ciphered words. The next lines each contain a word consisting of lowercase Latin letters — the text of the cipher received by Ihor. The length of each word does not exceed .
Output the number of the ciphered word which, before encryption, was lexicographically minimal in the Cyrillic alphabet. The ciphers are numbered starting from one in the order they appear in the input file.
Example 1