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.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;
public class Main extends Thread  {
    boolean[] prime;
    FastScanner sc;
    PrintWriter pw;
    long startTime = System.currentTimeMillis();
    final class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
 
        public long nlo() {
            return Long.parseLong(next());
        }
 
        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }
 
        public int ni() {
            return Integer.parseInt(next());
        }
 
        public String nli() {
            String line = "";
            if (st.hasMoreTokens()) line = st.nextToken();
            else try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            while (st.hasMoreTokens()) line += " " + st.nextToken();
            return line;
        }
 
        public double nd() {
            return Double.parseDouble(next());
        }
    }
    public Main(ThreadGroup t,Runnable r,String s,long d )
    {
        super(t,r,s,d);
    }
    public void run()
    {
        sc=new FastScanner();
        pw=new PrintWriter(System.out);
        solve();
        pw.flush();
        pw.close();
    }
    public static void main(String[] args)
    {
        new Main(null,null,"",1<<25).start();
    }
 
 
    /////////////------------------------------------//////////////
    ////////////------------------Main-Logic--------//////////////
    ///////////-------------------------------------//////////////
  
     public static int[] visit;
    public static int res,e;
    public static StringBuilder str;
    public static HashSet<Integer>[] adj;
    public void solve() {
    int t=sc.ni();
      while(t-->0)
      {
        
         visit=new int[26];
         adj=new HashSet[26];
         for(int i=0;i<26;i++)
         adj[i]=new HashSet();
         char[] arr=sc.next().toCharArray();
         int n=arr.length;
    
         if(n==1)
         {
             pw.println("YES");
             for(int i=0;i<26;i++)
             {
                 char c=(char)(i+'a');
                 pw.print(c);
             }
             pw.println("");
         }
         else{
             res=0;
             if(arr[0]!=arr[1])
         {e++;adj[arr[0]-'a'].add(arr[1]-'a');}
         if(arr[n-1]!=arr[n-2])
         {adj[arr[n-1]-'a'].add(arr[n-2]-'a');e++;}
             for(int i=1;i<n-1;i++)
             {
                 if(arr[i]!=arr[i-1])
                 {e++;adj[arr[i]-'a'].add(arr[i-1]-'a');}
                 if(arr[i]!=arr[i+1])
                 {adj[arr[i]-'a'].add(arr[i+1]-'a');e++;}
                 
             }
             e/=2;
             int k=0,p=-1;
             int j=-1;
             e=0;
             for(int i=0;i<26;i++)
             {
                 for(int kk:adj[i])
                 e++;
                 if(adj[i].size()>2)
                 res=-1;
                   if(adj[i].size()==2)
                   j=0;
                 if(adj[i].size()==1)
                     {p=i;}
             }
             e/=2;
             if((j==0)&&(p==-1))
             res=-1;
             if(res==0)
             {
                 str=new StringBuilder();
                 Arrays.fill(visit,0);
                for(int i=0;i<26;i++)
                 {
                    // System.out.println("ggdsf");
                     if((visit[i]==0)&&(adj[i].size()==1))
                     dfs(i);
                 }
                 if(e!=0)
                 res=-1;
                 if(res==0)
                 {
                     for(int i=0;i<26;i++)
                     {
                         if(visit[i]==0)
                         {
                             char c=(char)(i+'a');
                             str.append(c);
                         }
                     }
                     pw.println("YES");
                     pw.println(str);
                 }
                 else
                 pw.println("NO");
             }
             else
             pw.println("NO");
         }
    }
   }
   public static void dfs(int x)
   {
      //System.out.println(x+"  sgrgr");
       visit[x]=1;
       char c=(char)(x+'a');
       str.append(c);
       int p=0;
       for(int y:adj[x])
       {
           if(visit[y]==1)
           {
               p++;
               if(p>1)
              { res=-1;
               return;}
           }
           else{e--;
           dfs(y);}
       }
   }
    
}