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
from math import log2,floor,ceil
# import bisect
# from collections import deque

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10**9+7

for _ in range(int(ri())):
    dic2 ={}
    dic1 ={}
    st = ri()

    dic1[st[0]] = 0
    dic2[0] = st[0]
    flag  =True
    for i in range(1,len(st)):
        ch = st[i]
        if st[i] == st[i-1]:
            flag  = False
            break
        if st[i] not in dic1:
            pos = dic1[st[i-1]]
            if pos+1 in dic2 and dic2[pos+1] == st[i]:
                continue
            elif pos-1 in dic2 and dic2[pos-1] == st[i]:
                continue
            if pos+1 not in dic2:
                dic1[st[i]] =  pos+1
                dic2[pos+1] = st[i]
                continue
            elif pos-1 not in dic2:
                dic1[st[i]] = pos-1
                dic2[pos-1] = st[i]
                continue
            else:
                flag = False
                break
        else:
            pos1  = dic1[st[i]]
            pos2=  dic1[st[i-1]]
            if abs(pos1 - pos2) > 1:
                flag = False
                break
    if not flag:
        NO()
    else:

        YES()
        minn = min([dic1[i] for i in dic1])
        ans = [-1]*26
        for i in dic2:
            ans[i+abs(minn)] = dic2[i]
        ite = 25
        # print(ans)
        for i in range(25,-1,-1):
            if chr(ord('a')+i) not in dic1:
                ans[ite] = chr(ord('a')+i)
                dic1[chr(ord('a')+i)] = ite
                ite-=1
        print("".join(ans))