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:
def binarySearch(arr,x):
	l=0
	r=len(arr)-1 
	while l <= r: 
		mid = (l + r)//2; 
		if arr[mid] == x: 
			return mid 
		elif arr[mid] < x: 
			l = mid + 1
		else: 
			r = mid - 1
	return -1

def js(arr,x):
	l=0
	r=len(arr)-1
	ans=-1
	while(l<=r):
		m=(l+r)//2
		if(arr[m]<=x):
			ans=m
			l=m+1
		else:
			r=m-1
	return ans

def jg(arr,x):
	l=0
	r=len(arr)-1
	ans=-1
	while(l<=r):
		m=(l+r)//2
		if(arr[m]>=x):
			ans=m
			r=m-1
		else:
			l=m+1
	return ans
from math import *


# p=[]
# for i in range(2,1000001):
# 	b=0
# 	for j in range(2,int(i**0.5)+1):
# 		if(i%j==0):
# 			b=1
# 			break
# 	if(b==0):
# 		p.append(i)

# def isprime(n):
# 	return binarySearch(p,n)!=-1
	
# def factors(n):
# 	f=[]
# 	for i in range(2,int(n**0.5)+1):
# 		if(n%i==0):
# 			if(n%(n//i)==0):
# 				if(isprime(n//i)):
# 					f.append(n//i)
# 			if(isprime(i)):
# 				f.append(i)
# 	f.sort()
# 	return f[-1]

# n = int(input())
# from math import *
def ceil(a,b):
	if a%b == 0:
		return int(a/b)
	else:
		return (a//b + 1)

for __ in range(int(input())):
	s=input()
	h=[0]*26
	ans=s[0]
	h[ord(s[0])-97]=1
	e=True
	x=0
	for i in range(1,len(s)):
		if(i==1):
			ans+=s[i]
			h[ord(s[i])-97]=1
			x+=1
		else:
			if(x==len(ans)-1):
				if(s[i]==ans[x-1]):
					x-=1
				else:
					if(h[ord(s[i])-97]==1):
						e=False
						break
					else:
						ans+=s[i]
						h[ord(s[i])-97]=1
						x+=1
			elif(x==0):
				if(s[i]==ans[x+1]):
					x+=1
				else:
					if(h[ord(s[i])-97]==1):
						e=False
						break
					else:
						ans=s[i]+ans
						h[ord(s[i])-97]=1
			else:
				if(s[i]==ans[x+1]):
					x+=1
				elif(s[i]==ans[x-1]):
					x-=1
				else:
					e=False
					break
	if(e==False):
		print("NO")
	else:
		print("YES")
		for i in range(26):
			if(h[i]==0):
				ans+=chr(i+97)
		print(ans)