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:
import java.util.*;
 
import java.io.*;
import static java.lang.Long.max;
import static java.util.Arrays.sort;
 
 
public class Main {
    static FastReader in=new FastReader();
    static boolean A[]=new boolean[26];
    static List<Integer>[]L=new List[26];
    public static void main(String [] args) {
    int t=in.nextInt();
    while(t-->0){
    String S=in.next();
    int x[]=new int[26];
    Sd=new StringBuilder();
    A=new boolean[26];
    PP=new boolean[26];
    L=new List[26];
    po=false;
    boolean B[][]=new boolean[26][26];
     for(int i=0;i<26;i++){L[i]=new ArrayList();}
    for(int i=0;i<S.length()-1;i++){
    
    if(!B[S.charAt(i)-'a'][S.charAt(i+1)-'a']&&S.charAt(i)!=S.charAt(i+1)){
        x[S.charAt(i)-'a']++;x[S.charAt(i+1)-'a']++;
    L[S.charAt(i+1)-'a'].add(S.charAt(i)-'a');
    L[S.charAt(i)-'a'].add(S.charAt(i+1)-'a');
    }
    B[S.charAt(i)-'a'][S.charAt(i+1)-'a']=true;
    B[S.charAt(i+1)-'a'][S.charAt(i)-'a']=true;
    
    }
    boolean BB=true;
    for(int i=0;i<26;i++){if(x[i]>=3){System.out.println("NO");BB=false;break;}}
   if(BB)
    for(int i=0;i<26;i++){
    if(!PP[i]){loop(i,-1);}
    if(po){BB=false;System.out.println("NO");break;}
    }
    if(BB){System.out.println("YES");
   
    for(int i=0;i<26;i++){
        Sl="";
    if(!A[i]){DFS(i,0);Sd.append(Sl);}
    }
        System.out.println(Sd);}
      }
    }
    static long gcd(long g,long x){
        if(x<1)return g;
        else return gcd(x,g%x);
    }
    static StringBuilder Sd=new StringBuilder();
    static String Sl="";
    static void DFS(int o,int p){
    A[o]=true;
    if(p==1){Sl=Sl+(char)('a'+o);}
    else {Sl=(char)('a'+o)+Sl;}
    int w=0;
    for(int i:L[o]){
        if(!A[i]){
    if(p>0){
    DFS(i,p);
    }
    else{w++;
    DFS(i,w);}}
    }
    
    }
    static boolean PP[]=new boolean[26],po=false;
    static void loop(int o,int p){
    PP[o]=true;
    for(int i:L[o]){
    if(!PP[i]) loop(i,o);
    else{
    if(i!=p){po=true;
    return;}
    }
    }
    }
}
class FastReader
    {
        BufferedReader br;
        StringTokenizer st;
 
        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
}
 
class Sorting{
 
 public static int[] bucketSort(int[] array, int bucketCount) {
 
 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");
 
 if (array.length <= 1) return array; //trivially sorted
 
 
 
 int high = array[0];
 
 int low = array[0];
 
 for (int i = 1; i < array.length; i++) { //find the range of input elements
 
 if (array[i] > high) high = array[i];
 
 if (array[i] < low) low = array[i];
 
 }
 
 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket
 
 
 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];
 
 for (int i = 0; i < bucketCount; i++) { //initialize buckets
 
 buckets[i] = new ArrayList();
 
 }
 
 
 
 for (int i = 0; i < array.length; i++) { //partition the input array
 
 buckets[(int)((array[i] - low)/interval)].add(array[i]);
 
 }
 
 
 int pointer = 0;
 
 for (int i = 0; i < buckets.length; i++) {
 
 Collections.sort(buckets[i]); //mergeSort
 
 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets
 
 array[pointer] = buckets[i].get(j);
 
 pointer++;
 
 }
 
}
 
return array;
 
}
 
}