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.*;

public class A {
	public static Stack<Integer> st;
	public static boolean[] vis;
	public static boolean isPoss = true;
	public static TreeSet[] adj;

	public static void solve(FastReader in,PrintWriter out,int nTestCase) {
		char[] a = in.next().toCharArray();
		adj = new TreeSet[26];
		vis = new boolean[26];
		st = new Stack<Integer>();
		isPoss = true;
		for(int i=0;i<26;i++) adj[i] = new TreeSet<Integer>();
 		for(int i=0;i<a.length-1;i++) {
 			adj[a[i]-'a'].add(a[i+1]-'a');
 			adj[a[i+1]-'a'].add(a[i]-'a');
		}
 		StringBuilder ans = new StringBuilder();
 		for(int i=0;i<26;i++) {
 			if(!isPoss) break;
 			if(adj[i].size()==0) {
 				vis[i] = true;
 				ans.append((char)(i+'a'));
 			}
 			else if(adj[i].size()>2) {
 				isPoss = false;
 				break;
 			}
 			else if(adj[i].size()==1) {
 				if(vis[i]) continue;
 				ArrayDeque<Integer> pq = new ArrayDeque<Integer>();
 				pq.addFirst(i);
 				vis[i] = true;
 				while(!pq.isEmpty()) {
 					int top = pq.poll();
 					ans.append((char)(top+'a'));
 					if(adj[top].size()>2) {
 						isPoss = false;
 						break;
 					}
 					TreeSet<Integer> cut  = adj[top];
 					for(int j:cut) {
 						if(!vis[j]) {
 							pq.addLast(j);
 							vis[j] = true;
 						}
 					}
 				}
 			}
 		}
 		if(isPoss&&ans.length()==26) {
 			out.println("YES");
 			out.println(ans);
 		}
 		else {
 			out.println("NO");
 		}
	}
	public static void main(String[] args) {
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		long startT = System.currentTimeMillis();
		int T = in.nextInt();
//		int T = 1;
		for(int tt=1;tt<=T;tt++) {
			solve(in,out,tt);
		}
		if(System.getProperty("ONLINE_JUDGE")==null)
			out.println("Total time: "+(System.currentTimeMillis()-startT)+"ms");
		out.close();
	}
	static final Random random=new Random();
	//	static void ruffleSort(Pair[] a) {
	//		int n=a.length;//shuffle, then sort 
	//		for (int i=0; i<n; i++) {
	//			int oi=random.nextInt(n);
	//			Pair temp=a[oi];
	//			a[oi]=a[i]; a[i]=temp;
	//		}
	//		Arrays.sort(a);
	//	}
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	static void fastSort(char[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n);
			char temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	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; 
		} 

		int[] nextArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
	}
}

//class Pair implements Comparable<Pair>{
//    int a;
//    int b;
//    public Pair(int a, int b) {
//        this.a = a;
//        this.b = b;
//    }
//    public int compareTo(Pair o) {
//        if(this.a==o.a)
//            return this.b - o.b;
//        return this.a - o.a;
//    }   
//}