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 JAVA):

Solution:
// No sorceries shall previal. //         
import java.io.*;
import java.util.*;
     
public class _InVoker_ {
	static long mod = 1000000007;
    public static void sort(long arr[], int start, int end) { 		
		if(start>=end)
			return;		
		int mid=(start+end)/2;
		sort(arr,start,mid);
		sort(arr,mid+1,end);
		merge(arr,start,mid,end);	
	}	
	private static void merge(long arr[], int start, int mid, int end) {		
		int i, j=mid+1,c=0;
		long temp[]= new long[end-start+1];
		for(i=start;i<=mid && j<=end;c++) {
			if(arr[i]<=arr[j]) {
				temp[c]=arr[i];
				i++;
			}
			else {
				temp[c]=arr[j];
				j++;
			}
		}
		while(i<=mid) {
			temp[c]=arr[i];
			i++;c++;
		}
		while(j<=end) {
			temp[c]=arr[j];
			j++;c++;
		}
		c=0;
		for(i=start;i<=end;i++,c++)
			arr[i]=temp[c];
	}
	static long gcd(long a, long b) 
    { 
      if (b == 0) 
        return a; 
      return gcd(b, a % b);  
    } 
	
	public static void main(String args[]) {
    		
    	Scanner inp=new Scanner(System.in);
    	PrintWriter out= new PrintWriter(System.out);
    	
    	int t=inp.nextInt();
    	while(t-->0) {
    		String s=inp.next();
    		int n=s.length();
    		char ans[]=new char[60];
    		for(int i=0;i<60;i++) {
    			ans[i]='0';
    		}
    		int leftEnd=30,rightEnd=30;
    		boolean can=true;
    		boolean printed[]=new boolean[26];
    		ans[30]=s.charAt(0);
    		int j=30;
    		printed[ans[30]-'a']=true;
    		for(int i=1;i<n;i++) {
    			if(printed[s.charAt(i)-'a']) {
    				if(s.charAt(i)==ans[j-1]) {
    					j--;
    				}
    				else if(s.charAt(i)==ans[j+1]) {
    					j++;
    				}
    				else {
    					can=false;
    					break;
    				}
    			}
    			else {
    				if(ans[j-1]=='0') {
    					ans[--j]=s.charAt(i);
    					printed[s.charAt(i)-'a']=true;
    				}
    				else if(ans[j+1]=='0') {
    					ans[++j]=s.charAt(i);
    					printed[s.charAt(i)-'a']=true;
    				}
    				else {
    					can=false;
    					break;
    				}
    			}
    		}
    		if(can) {
    			out.println("YES");
    			for(int i=0;i<60;i++) {
    				if(ans[i]!='0') {
    					out.print(ans[i]);
    				}
    			}
    			for(int i=0;i<26;i++) {
    				if(!printed[i]) {
    					out.print((char)('a'+i));
    				}
    			}
    			out.println();
    		}
    		else {
    			out.println("NO");
    		}
    	}
    	
    	inp.close();
    	out.close();
    }	
}