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
import java.util.*;
import java.io.*;  

public class Solution{
    public static class pair{
        int x;
        int y;
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t=Integer.parseInt(br.readLine());
        while(t-->0){
            int c=0;
            HashMap<Character,ArrayList<Character>> map=new HashMap<>();
            String line=br.readLine();
            if(line.length()==1){
                System.out.println("YES");
                System.out.print(line.charAt(0));
                for(char w='a';w<='z';w++){
                    if(w!=line.charAt(0)){
                        System.out.print(w);
                    }
                }
                System.out.println();
                continue;
            }
            for(int i=0;i<line.length();i++){
                char ch=line.charAt(i);
                if(i-1>=0){
                    char ch1=line.charAt(i-1);
                    if(map.containsKey(ch)){
                        ArrayList<Character> list=map.get(ch);
                        int z=0;
                        for(int j=0;j<list.size();j++){
                            if(list.get(j)==ch1){
                                z=1;
                                break;
                            }
                        }
                        if(z==1){
                            
                        }else{
                        if(list.size()==2){
                            c=1;
                            break;
                        }else{
                            list.add(ch1);
                        }
                        map.put(ch,list);
                        }
                    }else{
                        ArrayList<Character> list=new ArrayList<>();
                        list.add(ch1);
                        map.put(ch,list);
                    }
                }
                if(i+1<line.length()){
                    char ch1=line.charAt(i+1);
                    if(map.containsKey(ch)){
                        ArrayList<Character> list=map.get(ch);
                        int z=0;
                        for(int j=0;j<list.size();j++){
                            if(list.get(j)==ch1){
                                z=1;
                                break;
                            }
                        }
                        if(z==1){
                            
                        }else{
                        if(list.size()==2){
                            c=1;
                            break;
                        }else{
                            list.add(ch1);
                        }
                        map.put(ch,list);
                        }
                    }else{
                        ArrayList<Character> list=new ArrayList<>();
                        list.add(ch1);
                        map.put(ch,list);
                    }
                }
            }
            if(c==1){
                System.out.println("NO");
                continue;
            }
            ArrayList<Character> list=new ArrayList<>();
            for(char ch:map.keySet()){
                if(map.get(ch).size()==1){
                    list.add(ch);
                }
            }
            if(list.size()!=2){
                System.out.println("NO");
                continue;
            }
            HashSet<Character> set=new HashSet<>();
            for(char a='a';a<='z';a++){
                set.add(a);
            }
            StringBuilder sb=new StringBuilder();
            boolean q=false;
            sb.append(list.get(0)+"");
            set.remove(list.get(0));
            while(!set.isEmpty()){
                if(!q){
                char ch=sb.charAt(sb.length()-1);
                ArrayList<Character> l=map.get(ch);
                if(set.contains(l.get(0))){
                    char s=l.get(0);
                    sb.append(s);
                    set.remove(s);
                }else{
                    if(l.size()==1){
                        q=true;
                        continue;
                    }
                    if(set.contains(l.get(1))){
                        char s=l.get(1);
                        sb.append(s);
                        set.remove(s);
                    }else{
                         
                    }
                }
                }else{
                    for(char w='a';w<='z';w++){
                        if(set.contains(w)){
                            sb.append(w+"");
                            set.remove(w);
                        }
                    }
                }
            }
            System.out.println("YES");
            System.out.println(sb);
        }
    }
     static String findSum(String str1, String str2)  
{  
    // Before proceeding further, make sure length  
    // of str2 is larger.  
    if (str1.length() > str2.length()){  
        String t = str1; 
        str1 = str2; 
        str2 = t; 
    } 
  
    // Take an empty String for storing result  
    String str = "";  
  
    // Calculate length of both String  
    int n1 = str1.length(), n2 = str2.length();  
  
    // Reverse both of Strings 
    str1=new StringBuilder(str1).reverse().toString(); 
    str2=new StringBuilder(str2).reverse().toString(); 
  
    int carry = 0;  
    for (int i = 0; i < n1; i++)  
    {  
        // Do school mathematics, compute sum of  
        // current digits and carry  
        int sum = ((int)(str1.charAt(i) - '0') +  
                    (int)(str2.charAt(i) - '0') + carry);  
        str += (char)(sum % 10 + '0');  
  
        // Calculate carry for next step  
        carry = sum / 10;  
    }  
  
    // Add remaining digits of larger number  
    for (int i = n1; i < n2; i++)  
    {  
        int sum = ((int)(str2.charAt(i) - '0') + carry);  
        str += (char)(sum % 10 + '0');  
        carry = sum / 10;  
    }  
  
    // Add remaining carry  
    if (carry > 0)  
        str += (char)(carry + '0');  
  
    // reverse resultant String 
    str = new StringBuilder(str).reverse().toString(); 
  
    return str;  
} 
    static String multiply(String num1, String num2) 
{ 
    int len1 = num1.length(); 
    int len2 = num2.length(); 
    if (len1 == 0 || len2 == 0) 
        return "0"; 
  
    // will keep the result number in vector 
    // in reverse order 
    int result[] = new int[len1 + len2]; 
  
    // Below two indexes are used to  
    // find positions in result.  
    int i_n1 = 0;  
    int i_n2 = 0;  
      
    // Go from right to left in num1 
    for (int i = len1 - 1; i >= 0; i--) 
    { 
        int carry = 0; 
        int n1 = num1.charAt(i) - '0'; 
  
        // To shift position to left after every 
        // multipliccharAtion of a digit in num2 
        i_n2 = 0;  
          
        // Go from right to left in num2              
        for (int j = len2 - 1; j >= 0; j--) 
        { 
            // Take current digit of second number 
            int n2 = num2.charAt(j) - '0'; 
  
            // Multiply with current digit of first number 
            // and add result to previously stored result 
            // charAt current position.  
            int sum = n1 * n2 + result[i_n1 + i_n2] + carry; 
  
            // Carry for next itercharAtion 
            carry = sum / 10; 
  
            // Store result 
            result[i_n1 + i_n2] = sum % 10; 
  
            i_n2++; 
        } 
  
        // store carry in next cell 
        if (carry > 0) 
            result[i_n1 + i_n2] += carry; 
  
        // To shift position to left after every 
        // multipliccharAtion of a digit in num1. 
        i_n1++; 
    } 
  
    // ignore '0's from the right 
    int i = result.length - 1; 
    while (i >= 0 && result[i] == 0) 
    i--; 
  
    // If all were '0's - means either both  
    // or one of num1 or num2 were '0' 
    if (i == -1) 
    return "0"; 
  
    // genercharAte the result String 
    String s = ""; 
      
    while (i >= 0) 
        s += (result[i--]); 
  
    return s; 
} 
    
    public static int comb(int val){
        long v=1;
        for(int i=1;i<=val;i++){
            v*=i;
        }
        long v2=1;
        for(int i=1;i<=val-2;i++){
            v2*=i;
        }
        long a=v/v2;
        a=a/2;
        return (int)a;
    }
    public static class Comp implements Comparator<pair>{
        public int compare(pair a,pair b){
            if(a.x!=b.x){
                return b.x-a.x;
            }else{
                return a.y-b.y;
            }
        }
    }
    public static int gcd(int a,int b){
        if (b == 0) 
        return a; 
        return gcd(b, a % b);
    }
    public static int lcm(int a,int b){
        int x=Math.max(a,b);
        int y=Math.min(a,b);
        long ans=x;
        while(ans%y!=0){
            ans+=x;
        }
        if(ans>Integer.MAX_VALUE){
            return -1;
        }
        return (int)ans;
    }
    public static long fact(int n){
        long ans=1;
        for(int i=1;i<=n;i++){
            ans*=i;
        }
        return ans;
    }
}