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.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main
{
  //your static variables go here:

  static ArrayList<Integer> graph[];
  static boolean vis[];
  static int seive[]=new int[1000001];
  static int dis[]=new int[1000001];
  static int subtree[]=new int[1000001];


  static int time=0;
  //******************************************************************
  static 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;}
    }
//*************************************************************************
/**

*/
//left right is for query range
public static void build(int a[], long seg[], int start, int end, int cur)
{
  if(start>end)
  return;
  if(start==end)
  {
    seg[cur]=seive[a[start]];
    return;
  }
  int mid=start+(end-start)/2;
  build(a, seg, start, mid, 2*cur+1);
  build(a,seg, mid+1, end, 2*cur+2);
  seg[cur]=seg[2*cur+1]+seg[2*cur+2];
}
public static long query( int left, int right, int start, int end, int cur, long seg[] )
{
  if(start>end)
  return 0;
  if(left>end||right<start)
    return 0;
  if(left<=start&&right>=end)
    return seg[cur];
  int mid=start+(end-start)/2;
  return query(left,right,start, mid, 2*cur+1, seg)+query( left, right, mid+1, end, 2*cur+2, seg);
}

public static void update( int left, int right, int start, int end, int cur, long seg[], long value)
{
  if(start>end)
    return;
  if(left>end||right<start)
    return;
  if(start==end)
  {
    //a[start]=value*value;
    seg[cur]=value;
    return;
  }
  int mid=start+(end-start)/2;
   update(left,right,start, mid, 2*cur+1, seg, value);update( left, right, mid+1, end, 2*cur+2, seg, value);
   seg[cur]=(seg[cur*2+1]+seg[cur*2+2]);
}
public static void fill_seive()
{
  seive[0]=1;
  seive[1]=1;
  for( int i=2;i<1000001;i++)
  {
    if(seive[i]==0)
    {
      seive[i]=i;
      for( int j=i;j<1000001;j+=i)
      {
        if(seive[j]==0)
        {
          seive[j]=i;
        }
      }
    }
  }

}
//
/*
take a vertex and start with the discovering time from the root
now for range query and point update the following works
can also think of the solution using the euler tour
*/
public static void eulerlist(int u)
{
  vis[u]=true;
  dis[u]=time;
  time++;
  for( int i=0;i<graph[u].size();i++)
  {
    int v=graph[u].get(i);
    if(!vis[v])
    {
      eulerlist(v);
      subtree[u]+=subtree[v];
    }
  }
}
public static void main(String[] args)
{
    FastReader sc=new FastReader();
    StringBuilder sb=new StringBuilder();
    int t=sc.nextInt();
    while(t-->0)
    {
      String str=sc.next();
      boolean check=true;
      char s[]=str.toCharArray();
      int n=s.length;
      String ans="";
      ans=s[0]+"";
      int pointer =0;
      int vis[]=new int[26];
      vis[s[0]-'a']=1;
      //dq.addLast(s[0]);
      for( int i=1;i<n;i++)
      {
        if(ans.charAt(pointer)==s[i])
        {
          continue;
        }
        else if(pointer-1>=0&&ans.charAt(pointer-1)==s[i])
        {
          pointer--;
          continue;

        }
        else if(pointer+1<ans.length()&&ans.charAt(pointer+1)==s[i])
        {
          pointer++;
          continue;
        }
        else if(vis[s[i]-'a']==1)
        {
          check=false;
          break;
        }
        else
        {
          if(pointer+1<ans.length()&&pointer==0)
          {ans=s[i]+ans;vis[s[i]-'a']=1;}
          else if(pointer+1>=ans.length())
          {ans+=s[i];
          pointer++;
          vis[s[i]-'a']=1;
        }
        else check=false;

        }
      }
      for( int i=0;i<26;i++)
      {
        if(vis[i]==0)
        ans+=(char)(i+'a');
      }
      if(check==false)
      {
        sb.append("NO");
      }
      else
      {
        sb.append("YES");
        sb.append("\n");
        sb.append(ans);
      }
    //  sb.append(ans);
      sb.append("\n");
    }
System.out.println(sb.toString());

}
}



class Pair
{
  int f,s;
  Pair( int f, int s)
  {
    this.f=f;
    this.s=s;
  }
}