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:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
*/
import java.util.*;
import java.io.*;

   public class C2
   {
      public static void main(String omkar[]) throws Exception
      {
         //BufferedReader infile = new BufferedReader(new FileReader("cowdate.in"));
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int T = Integer.parseInt(st.nextToken());
         StringBuilder sb = new StringBuilder();
         outer:for(int qw=0; qw < T; qw++)
         {
            st = new StringTokenizer(infile.readLine());
            String input = st.nextToken();
            char[] arr = input.toCharArray();
            int N = arr.length;
            if(N == 1)
            {
               sb.append("YES\nqazwsxedcrfvtgbyhnujmikolp\n");
               continue outer;
            }
            boolean[][] edge = new boolean[300][300];
            edge[arr[0]][arr[1]] = true;
            edge[arr[1]][arr[0]] = true;
            for(int i=2; i < N; i++)
            {
               edge[arr[i]][arr[i-1]] = true;
               edge[arr[i-1]][arr[i]] = true;
            }
            LinkedList<Character>[] edges = new LinkedList[300];
            String alpha = "qazwsxedcrfvtgbyhnujmikolp";
            for(char c: alpha.toCharArray())
            {
               LinkedList<Character> ls = new LinkedList<Character>();
               for(int i=0; i < 26; i++)
                  if(edge[c][alpha.charAt(i)] && c != alpha.charAt(i))
                     ls.add(alpha.charAt(i));
               edges[c] = ls;
            }
            int min = 2;
            for(char c: alpha.toCharArray())
            {
               int adj = edges[c].size();
               if(adj == 0) //not in input
                  continue;
               if(adj > 2)
               {
                  sb.append("NO\n");
                  continue outer;
               }
               min = Math.min(min, adj);
            }
            if(min == 2)
            {
               sb.append("NO\n");
               continue outer;
            }
            char root = '$';
            for(char c: alpha.toCharArray())
               if(edges[c].size() == 1)
               {
                  root = c;
                  break;
               }
            String res = bfs(root, edges);
            sb.append("YES\n").append(res).append("\n");
         }
         System.out.print(sb);
      }
      public static String bfs(char c1, LinkedList<Character>[] edges)
      {
         String res = c1+"";
         Queue<Character> q = new LinkedList<Character>();
         q.add(c1);
         boolean[] seen = new boolean[300];
         seen[c1] = true;
         while(q.size() > 0)
         {
            char c = q.poll();
            for(char next: edges[c])
               if(!seen[next])
               {
                  seen[next] = true;
                  res += next;
                  q.add(next);
               }
         }
         String alpha = "qazwsxedcrfvtgbyhnujmikolp";
         for(int a=0; a < 26; a++)
         {
            boolean lol = true;
            for(char c: res.toCharArray())
               if(c == alpha.charAt(a))
               {
                  lol = false;
                  break;
               }
            if(lol)
               res += alpha.charAt(a);
         }
         return res;
      }
   }