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())

def dfs_visit(G, u, found_cycle, pred_node, marked):
    if found_cycle[0]:                                # - Stop dfs if cycle is found.
        return
    marked[u] = True                                  # - Mark node.
    for v in G[u]:                                    # - Check neighbors, where G[u] is the adjacency list of u.
        if marked[v] and v != pred_node:              # - If neighbor is marked and not predecessor,
            found_cycle[0] = True                     # then a cycle exists.
            return
        if not marked[v]:                             # - Call dfs_visit recursively.
            dfs_visit(G, v, found_cycle, u, marked)
            
def cycle_exists(G):                      # - G is an undirected graph.              
    marked = { u : False for u in G }     # - All nodes are initially unmarked.
    found_cycle = [False]                 # - Define found_cycle as a list so we can change
                                          # its value per reference, see: 
    for u in G:                           # - Visit all nodes.
        if not marked[u]:
            dfs_visit(G, u, found_cycle, u, marked)     # - u is its own predecessor initially
        if found_cycle[0]:
            break
    return found_cycle[0]

def dfs_util(x,marked):
    global adj
    marked[x]=True
    dfs_said.append(chr(x+97))
    for i in adj[x]:
        if marked[i]==False:
            dfs_util(i,marked)
def dfs(x):
    global adj
    marked=[False]*26
    dfs_util(x,marked)
    return dfs_said
for i in range(t):
    s=input()
    if(len(s)==1):
        print("YES")
        print("abcdefghijklmnopqrstuvwxyz")
        continue
    s='-'+s+'-'
    adj={}
    flag=0
    for j in range(1,len(s)-1):
        if(ord(s[j])-97) not in adj:
            adj[ord(s[j])-97]=[]
        c1=s[j-1]
        c2=s[j+1]
        if(c1!='-'):
            if(ord(c1)-97) not in adj[ord(s[j])-97]:
                if(len(adj[ord(s[j])-97])<2):
                    adj[ord(s[j])-97].append(ord(c1)-97)
                else:
                    flag=1
                    break
        if(c2!='-'):
            if(ord(c2)-97) not in adj[ord(s[j])-97]:
                if(len(adj[ord(s[j])-97])<2):
                    adj[ord(s[j])-97].append(ord(c2)-97)
                else:
                    flag=1
                    break
    if(flag==1):
        print("NO")
        continue
    if(cycle_exists(adj)):
        print("NO")
        continue
    else:
        for j in adj:
            if(len(adj[j])==1):
                start=j
                break
    dfs_said=[]
    path=dfs(start)
    done=[1]*26
    for j in range(len(path)):
        done[ord(path[j])-97]=0
    path2=''
    for j in range(len(done)):
        path2=path2+done[j]*chr(j+97)
    print("YES")
    print(''.join(path)+path2)