This content is archived!

For the 2018-2019 school year, we have switched to using the WLMOJ judge for all MCPT related content. This is an archive of our old website and will not be updated.

Problem

Sally loves palindromes and has made it her goal to memorize every palindrome in existence. A palindrome is a string that is the same whether it is read forwards or backwards.

For example, the following strings are all palindromes:

Dad
Racecar
A man, a plan, a canal, panama! (If we ignore punctuation)

Sally wants to read the dictionary and memorize every palindrome. Help her figure out whether certain words are palindromes.


Input

The first line of input provides the number of test cases, T (1 \leq T \leq 100). T test cases follow. Each test case consists of one word containing exclusively uppercase letters.

Output

For each test case, your program should output one line containing YAY if the word is a palindrome, or NAY otherwise.


Sample Input

4
DAD
TOOT
DOORKNOB
RACECAR

Sample Output

YAY
YAY
NAY
YAY

Editorial

Read only if you are stuck or have already solved the problem.