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
/*
    JAI MATA DI
 */

import java.util.*;

import java.io.*;
import java.math.BigInteger;
import java.sql.Array;



public class Main {
	  static class FR{
		  
			BufferedReader br;
			StringTokenizer st;
			public FR() {
				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; 
		    } 
		}
	 static long mod = (long)(1e9 + 7);
	 static long gcd(long a, long b)
	  {      
	     if (b == 0)
	        return a;
	     return gcd(b, a % b); 
	  }
	static void sort(long[] arr ) {
		 ArrayList<Long> al = new ArrayList<>();
		 for(long e:arr) al.add(e);
		 Collections.sort(al);
		 for(int i = 0 ; i<al.size(); i++) arr[i] = al.get(i);
	 }
	static void sort(int[] arr ) {
		 ArrayList<Integer> al = new ArrayList<>();
		 for(int e:arr) al.add(e);
		 Collections.sort(al);
		 for(int i = 0 ; i<al.size(); i++) arr[i] = al.get(i);
	 }
	static int UB(long[] arr , long find , int l , int r) {
		while(l<=r) {
			int m = (l+r)/2;
			if(arr[m]<find) l = m+1;
			else r = m-1;
		}
		return l;
	}
	static int LB(long[] arr , long find,int l ,int r ) {
		while(l<=r) {
			int m = (l+r)/2;
			if(arr[m] > find) r = m-1;
			else l = m+1;
		}
		return r;
	}
	static int UB(int[] arr , long find , int l , int r) {
		while(l<=r) {
			int m = (l+r)/2;
			if(arr[m]<find) l = m+1;
			else r = m-1;
		}
		return l;
	}
	static int LB(int[] arr , long find,int l ,int r ) {
		while(l<=r) {
			int m = (l+r)/2;
			if(arr[m] > find) r = m-1;
			else l = m+1;
		}
		return r;
	}
	 static boolean[] prime(int num) {
			boolean[] bool = new boolean[num];
		     
		      for (int i = 0; i< bool.length; i++) {
		         bool[i] = true;
		      }
		      for (int i = 2; i< Math.sqrt(num); i++) {
		         if(bool[i] == true) {
		            for(int j = (i*i); j<num; j = j+i) {
		               bool[j] = false;
		            }
		         }
		      }
		      if(num >= 0) {
		    	  bool[0] = false;
		    	  bool[1] = false;
		      }
		      
		      return bool;
		}
	 static void sort(char[] arr) {
		 ArrayList<Character> al = new ArrayList<Character>();
		 for(char cc:arr) al.add(cc);
		 Collections.sort(al);
		 for(int i = 0 ;i<arr.length ;i++) arr[i] = al.get(i);
		 
	 }
	 static int ncr(int n, int k)
	    {
	        long C[][] = new long[n + 1][k + 1];
	        int i, j;
	 
	        // Calculate  value of Binomial
	        // Coefficient in bottom up manner
	        for (i = 0; i <= n; i++) {
	            for (j = 0; j <= Math.min(i, k); j++) {
	                // Base Cases
	                if (j == 0 || j == i)
	                    C[i][j] = 1;
	 
	                // Calculate value using
	                // previously stored values
	                else
	                    C[i][j] = (C[i - 1][j - 1] + C[i - 1][j])%mod;
	            }
	        }
	 
	        return (int)C[n][k];
	    }

/* ***************************************************************************************************************************************************/	 
	 static FR sc = new FR();
	 static StringBuilder sb = new StringBuilder();
	 public static void main(String args[]) {
		 int tc = 1;
		  tc = sc.nextInt();
		 
		 
		 while(tc-->0) {
				
			 TEST_CASE();
		 }
	    System.out.println(sb);
	 }
	 static void TEST_CASE() {
		 String str = sc.next();
		 int n = str.length();
		 int[] alpha = new int[26];
		 ArrayList<Set<Integer>> adj = new ArrayList<Set<Integer>>();
		 for(int i = 0 ; i<26 ; i++) adj.add(new HashSet<Integer>());
		 
		 for(int i = 0 ; i<n ; i++) {
			 char cc = str.charAt(i);
			 if(i-1 >=0 ) adj.get(cc-'a').add(str.charAt(i-1)-'a');
			 if(i+1 < n) adj.get(cc-'a').add(str.charAt(i+1)-'a');
		 }
		 int f = -1;
		 for(int i = 0 ; i<26 ; i++) {
			 if(adj.get(i).size()>2) {
				 sb.append("NO\n");return;
			 }
			 if(adj.get(i).size() == 1) {
				 f = i;
			 }
		 }
		 if(n == 1) {
			 sb.append("YES\n");
			 sb.append(str.charAt(0));
			 for(int i = 0 ; i<26 ;i++) {
				 if(i!=str.charAt(0)-'a')
					 sb.append((char)(i+'a'));
			 }sb.append("\n");
			 return;
		 }
		 if(f == -1 ) {
			 sb.append("NO\n");
			 return;
		 }
		 StringBuilder ans = new StringBuilder();
		 dfs(f, -1, adj, ans);
		 for(int i = 0 ; i<26 ; i++) {
			 if(adj.get(i).size() ==0) {
				 ans.append((char)(i + 'a'));
			 }
		 }
		 sb.append("YES\n");
		 sb.append(ans+"\n");
		 
	 }
	 static void dfs(int i ,int p, ArrayList<Set<Integer>> adj , StringBuilder ans) {
		 
		 ans.append((char)(i + 'a'));
		 for(int c:adj.get(i)) {
			 if(c!=p) {
				 dfs(c, i, adj, ans);
			 }
		 }
	 }

}














