Hide

Problem A
Chemist's vows

Chemist Clara swore a solemn vow—from now on, she can only speak atomic element symbols. Of course, this limits her ability to talk. She can say, for example, “I Am CLaRa” (as I is the symbol of iodine, Am is americium, C is carbon and so on). She can also say “InTeRnAtIONAl”, but she has a lot of trouble with “collegiate”, “programming” and “contest”.

Given a word, determine whether Clara can speak it (i.e. if it is a concatenation of atomic symbols). Without your help, she might as well have taken silence vows!

You may identify upper- and lowercase letters, as Clara cannot speak uppercase anyway. In case you forgot the elements’ symbols, here is the complete periodic table:

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  *   Hf  Ta  W   Re  Os  Ir  Pt  Au  Hg  Tl  Pb  Bi  Po  At  Rn

Fr  Ra  **  Rf  Db  Sg  Bh  Hs  Mt  Ds  Rg  Cn      Fl      Lv


*  La  Ce  Pr  Nd  Pm  Sm  Eu  Gd  Tb  Dy  Ho  Er  Tm  Yb  Lu
** Ac  Th  Pa  U   Np  Pu  Am  Cm  Bk  Cf  Es  Fm  Md  No  Lr

Input

The first line of the input contains the number of test cases T (where 1T10000). The descriptions of the test cases follow:

Each test case is a single lowercase word over the English alphabet. The length of the word is positive and does not exceed 50000. The total number of the length of all the words across all test cases is at most 220.

Output

Print the answers to the test cases in the order in which they appear in the input. For each test case print a single line containing the word YES if Clara can say the given word, and NO otherwise.

Sample Input 1 Sample Output 1
4
international
collegiate
programming
contest
YES
NO
NO
NO
Hide

Please log in to submit a solution to this problem

Log in