Leonardo's Notebook

Write a program that takes a permutation of the English alphabet as input and decides if it may be the result of performing some permutation twice.
Input

The input begins with a positive number on a line of its own telling the number of test cases (at most 500). Then for each test case there is one line containing a permutation of the 26 capital letters of the English alphabet.

Output

For each test case, output one line containing Yes if the given permutation can result from applying some permutation twice on the original alphabet string ABC...XYZ, otherwise output No.

Sample Input

2
QWERTYUIOPASDFGHJKLZXCVBNM
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Sample Output

No
Yes

http://www.acmerblog.com/hdu-1975-Leonardo%E2%80%99s-Notebook-3056.html

http://poj.org/problem?id=3128