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 math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush,heappop,heapify
from itertools import permutations,combinations
mod = int(1e9)+7
 
 
ip = lambda : int(stdin.readline())
inp = lambda: map(int,stdin.readline().split())
ips = lambda: stdin.readline().rstrip()
out = lambda x : stdout.write(str(x)+"\n")

def addEdge(a,b):
    graph[a].append(b)
    graph[b].append(a)
    graph[a] = list(set(graph[a]))
    graph[b] = list(set(graph[b]))
def Bfs(src):
    st = ""
    q = deque([])
    q.append(src)
    visited[src] = True
    st += src
    while(q):
        node = q.popleft()
        for neighbour in graph[node]:
            if(not visited[neighbour]):
                q.append(neighbour)
                st += neighbour
                visited[neighbour]= True
    return st

t = ip()
for _ in range(t):
    s = ips()
    n = len(s)
    graph = dd(list)
    ch = "abcdefghijklmnopqrstuvwxyz"
    if n == 1:
        ans = ch
        out("YES")
        out(ans)
    else:
        visited = dd(bool)
        for i in range(n):
            if i == 0:
                a,b = s[i],s[i+1]
                if a != b:
                    addEdge(a,b)
            elif i == n-1:
                a,b = s[i],s[i-1]
                if a != b:
                    addEdge(a,b)
            else:
                a,b = s[i],s[i+1]
                if a != b:
                    addEdge(a,b)
                a,b = s[i],s[i+1]
                if a != b:
                    addEdge(a,b)
        flag = True
        for i in set(s):
            if len(graph[i])>2:
                flag = False
                break
        ct = []
        for i in graph:
            if len(graph[i]) == 1:
                ct.append(i)
        if len(ct) != 2:
            flag = False
        if flag:
            st = ct[0]
            end = ct[1]
            ans = Bfs(st)
            if visited[end]:
                out("YES")
                for i in ch:
                    if i not in ans:
                        ans += i
                out(ans)
            else:
                out("NO")
        else:
            out("NO")