Problem: Polycarp wants to assemble his own keyboard. Layouts with multiple rows are too complicated for him — his keyboard will consist of only one row, where all 26 lowercase Latin letters will be arranged in some order.

Polycarp uses the same password s on all websites where he is registered (it is bad, but he doesn't care). He wants to assemble a keyboard that will allow to type this password very easily. He doesn't like to move his fingers while typing the password, so, for each pair of adjacent characters in s, they should be adjacent on the keyboard. For example, if the password is abacaba, then the layout cabdefghi... is perfect, since characters a and c are adjacent on the keyboard, and a and b are adjacent on the keyboard. It is guaranteed that there are no two adjacent equal characters in s, so, for example, the password cannot be password (two characters s are adjacent).

Can you help Polycarp with choosing the perfect layout of the keyboard, if it is possible?

Input

The first line contains one integer T (1 ≤ T ≤ 1000) — the number of test cases.

Then T lines follow, each containing one string s (1 ≤ |s| ≤ 200) representing the test case. s consists of lowercase Latin letters only. There are no two adjacent equal characters in s.

Output

For each test case, do the following:

  * if it is impossible to assemble a perfect keyboard, print NO (in upper case, it matters in this problem); 
  * otherwise, print YES (in upper case), and then a string consisting of 26 lowercase Latin letters — the perfect layout. Each Latin letter should appear in this string exactly once. If there are multiple answers, print any of them. 

Example

Input


5
ababa
codedoca
abcda
zxzytyz
abcdefghijklmnopqrstuvwxyza


Output


YES
bacdefghijklmnopqrstuvwxyz
YES
edocabfghijklmnpqrstuvwxyz
NO
YES
xzytabcdefghijklmnopqrsuvw
NO

Solution (in PYTHON3):

Solution:
import sys
import bisect
from collections import deque
 
def no():
    print("NO")    
 
def dist(z, c):
    return (z[0] - c[0]) * (z[0] - c[0]) + (z[1] - c[1]) * (z[1] - c[1]);
 
def vec(z, c):
    return z[0] * c[1] - z[1] * c[0]
    
def pro(z,c):
    return [z[0] - c[0], z[1] - c[1]]
 
def main():
    # q = [int(i) for i in sys.stdin.readline().split()]
    s = list(sys.stdin.readline())[:-1]
    cl = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10,
          'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20,
          'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
    cl1 = {0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f', 6: 'g', 7: 'h', 8: 'i', 9: 'j', 10: 'k',
           11: 'l', 12: 'm', 13: 'n', 14: 'o', 15: 'p', 16: 'q', 17: 'r', 18: 's', 19: 't', 20: 'u',
           21: 'v', 22: 'w', 23: 'x', 24: 'y', 25: 'z'}
    
    n = len(s)
    w = [set() for i in range(26)]
    for i in range(n - 1):
        x, y = cl[s[i]], cl[s[i + 1]]
        w[x].add(y)
        w[y].add(x) 
    res = []
    e = []
    for i in range(26):
        if len(w[i]) > 2:
            print("NO")
            return 0
        
        elif len(w[i]) == 1:
            e.append(i)
            
        elif len(w[i]) == 0:
            res.append(i)
    used = [0 for i in range(26)]
    for i in e:
        if used[i]:
            continue
        q = deque()
        q.append(i)
        while len(q):
            v = q.pop()
            used[v] = 1
            res.append(v)
            for u in w[v]:
                if not used[u]:
                    q.append(u)           
    
    if len(res) != 26:
        print("NO")
        return 0
    print("YES")
    for i in res:
        print(cl1[i], end="")
    print()
    
for i in range(int(sys.stdin.readline())):
    main()