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:
t=int(input())
for _ in range(t):
    s=input()
    if len(s)==1:
        print("YES")
        print("abcdefghijklmnopqrstuvwxyz")
        continue
    l=[]
    for i in range(26):
        l.append([])
    for i in range(len(s)):
        x=ord(s[i])-97
        if i==0:
            l[x].append(s[i+1])
        elif i==len(s)-1:
            l[x].append(s[i-1])
        else:
            l[x].append(s[i+1])
            l[x].append(s[i-1])
    flag=0
    for i in range(len(l)):
        l[i]=list(set(l[i]))
    for i in range(len(l)):
        if len(l[i])>2:
            print("NO")
            flag=1
            break
    if flag==1:
        continue
    newflag=0
    ans=""
    for i in range(26):
        s=""
        if chr(i+97) in ans or len(l[i])==0:
            continue
        if len(l[i])==2:
            s+=l[i][0]
            s+=chr(i+97)
            s+=l[i][1]
        elif len(l[i])==1:
            s+=l[i][0]
            s+=chr(i+97)
        while(True):
            x=ord(s[0])-97
            y=ord(s[len(s)-1])-97
            change=0
            for p in l[x]:
                if p not in s and p not in ans:
                    s=p+s
                    change+=1
                    break
                else:
                    if s[1]!=p:
                        newflag=1
                        break
            for q in l[y]:
                if q not in s and q not in ans:
                    s=s+q
                    change+=1
                    break
                else:
                    if s[len(s)-2]!=q:
                        newflag=1
                        break
            if change==0:
                break
        ans+=s
    for i in range(26):
        if len(l[i])==0:
            ans+=chr(i+97)
    if newflag==1:
        print("NO")
    else:
        print("YES")
        print(ans)