#00011D

Periodic table

The students of 3.a, Gimnazija Vič, Slovenia (2008/2009) were playing a special game during chemistry lession. For example, they wrote the word "water" as "WAtEr", as list of the following symbols for elements: Tungsten (W), Astatine (At) and Erbium (Er).


This game is representing such fun for them, so they are asking you to write a program to simplify their task. They contributed everything they could and wrote you the whole list of elements.


List of elements:
"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg"


InputIn first line, there will be a number 1 <= N <= 1200, followed by N lines, each containing a word (with only English lowercase letters), long from 1 to maximum 50 characters.

OutputOutput N lines, each containing word, converted to chemical symbols. If conversion isn't possible (ex. required combination of chemical elements doesn't exist), output 0 (zero) for that line.

In case there are multiple possible solutions for the same word, output the one that contains the most elements. This could, for example happen when you have "co" in a word. It could be written as "Co" (Cobalt) or "CO" (Carbon and Oxygen). Output "CO" in such cases!


Input:
8
schnops
chemistry
resolution
water
orange
crystal
sound
cacrnase


Output:
SCHNOPS
0
ReSOLuTiON
WAtEr
ORaNGe
0
SOUNd
CaCrNaSe

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.