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:
from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import ceil

# int_input=lambda : int(stdin.readline())
# string_input=lambda : stdin.readline().split()[0]
# multi_int_input =lambda : map(int, stdin.readline().split())
# multi_input = lambda : stdin.readline().split()
# list_input=lambda : list(map(int,stdin.readline().split()))
# string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7
lol = "abcdefghijklmnopqrstuvwxzy"
test = int(input())

for _ in range(test):
    string = input()

    if len(string) == 1:
        result= string
        for c in lol:
            if c != string:
                result+=c
        print("YES")
        print(result)
        
    else:
        dicti = {}
        for i in range(len(string)):
            if i!=r'\n':
                listi = []
                if i-1>=0:
                    listi.append(string[i-1])
                if i+1<len(string):
                    listi.append(string[i+1])
                if string[i] in dicti:
                    for items in listi:
                        dicti[string[i]].append(items)
                else:
                    dicti[string[i]] = listi

        flag = True
        count = 0
        for i in dicti:
            hehe = list(set(dicti[i]))
            dicti[i] = hehe
            # if len(hehe)>2 or (len(hehe) == 2 and (string[0] == i or string[-1] == i) and string[0]!=string[-1]):
                # flag = False
            if len(hehe) == 1:
                count+=1

        if count != 2:
            print("NO")
        else:
            added = set([])
            password = [-1]*len(dicti)
            # print(dicti)
            for i in dicti:
                if len(dicti[i]) == 1:
                    if password[0] == -1:
                        password[0] = i
                        password[1] = dicti[i][0]
                        
                    elif password[-1] == -1:
                        password[-1] = i
                        password[-2] = dicti[i][0]

                    added.add(i)
                    added.add(dicti[i][0])
            
            # print(password)
            ptr1,ptr2 = 1,-2
            while(len(added)!=len(dicti)):
                
                chars = dicti[password[ptr1]]
                for char in chars:
                    if char not in added:
                        password[ptr1+1] = char
                        ptr1+=1
                        added.add(char)

                chars = dicti[password[ptr2]]
                for char in chars:
                    if char not in added:
                        password[ptr2-1] = char
                        ptr2-=1
                        added.add(char)

            for c in range(97, 123): 
                if chr(c) not in added:
                    password.append(chr(c))
            # print(password)
            result = ""
            for i in password:
                result+=i
            print("YES")
            print(result)