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 math,sys
#from itertools import permutations, combinations;import heapq,random;
from collections import defaultdict,deque
import bisect as bi
def yes():print('YES')
def no():print('NO')
def I():return (int(sys.stdin.readline()))
def In():return(map(int,sys.stdin.readline().split()))
def Sn():return sys.stdin.readline().strip()
#sys.setrecursionlimit(1500)
import string
def dict(a):
    d={} 
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_left(a, x)
    if i != len(a):
        return i
    else:            
        return -1
def end(d,st):
    high=[-1]*(27)
    q=deque([st])
    high[ord(st)-96]=0
    ele,mx=st,0
    while q:
        node=q.popleft()
        for x in d[node]:
            if high[ord(x)-96]==-1:
                high[ord(x)-96]=high[ord(node)-96]+1
                if high[ord(x)-96]>mx:
                    mx=high[ord(x)-96]
                    ele=x
                q.appendleft(x)
    return ele

def main():
    try:
        s=Sn()
        n=len(s)
        d=defaultdict(set)
        ans=set(string.ascii_lowercase)
        parent={}
        for x in ans:
            parent[x]=-1
        if n==1:
            ans.remove(s[0])
            yes()
            print(s+''.join(list(ans)))
            return 
        elif n==2:
            ans.remove(s[0])
            ans.remove(s[1])
            yes()
            print(s+''.join(list(ans)))
            return
        ok=True
        
        d[s[0]].add(s[1])
        d[s[-1]].add(s[-2])
        for i in range(1,n-1):
            d[s[i]].add(s[i-1])
            d[s[i]].add(s[i+1])
            if len(d[s[i]])>2:
                ok=False
        if not ok :
            no()
            return
        an=[]
        start=end(d,s[0])
        q=deque(start)
        parent[start]=start
        while q:
            node=q.popleft()
            if node not in ans:
                continue
            an.append(node)
            ans.remove(node)
            for x in d[node]:
                if x in ans:
                    q.appendleft(x)
                    parent[x]=node
                else:
                    if parent[node]!=x:
                        ok=False
                        break
        if ok:
            yes()
            an=''.join(an)
            ans=list(ans)
            ans.sort()
            for x in ans:
                an+=x
            print(an)
        else:
            no()
    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    for _ in range(I()):main()
    # for _ in range(1):main()
#        *******************    All The Best    *******************   #