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.util.*;
import java.io.*;
 
public class codeforces {
	public static long GCD(long a, long b) {
		if(b==0)return a;
		if(a==0)return b;
		return (a>b)?GCD(a%b, b):GCD(a, b%a);
	}
	public static long LCM(long a, long b) {
		return a*b/GCD(a, b);
	}
	public static long nCk(int n, int k) { //O(K)
		if (k > n) {
			return 0;		
		}
		long res = 1;
		for(int i = 1; i<=k; i++) {
			res = (n - k + i) * res/i;
		}
		return res;
	}
	public static long C(int a, int b, long[][] s) {
		int m = (int) 1e9 + 7;
		if (s[a][b] >= 0) {
			return s[a][b];
		} else if (a < b | a < 0 | b < 0) {
			s[a][b] = 0;
			return 0;
		} else if (a == b | b == 0) {
			s[a][b] = 1;
			return 1;
		} else {
			return s[a][b] = (C(a - 1, b, s) % m + C(a - 1, b - 1, s) % m) % m;
		}
 
	}
 
	public static void main(String[] args) throws Exception {
 
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int t=sc.nextInt();
		for(int z=0;z<t;z++) {
			char[] l=new char[60];
			int[] q=new int[26];
			int p=27;
			boolean T=true;
			String s=sc.next();
			l[p]=s.charAt(0);
			q[s.charAt(0)-'a']=1;
			for(int i=1;i<s.length();i++) {
				char c=s.charAt(i);
				if(i==1) {
					q[c-'a']=1;
					p++;
					l[p]=c;
					
				}
				else {
					if(q[c-'a']==1) {
						if(c==l[(p-1)]) {
							p--;
						}
						else if(c==l[p+1]) {
							p++;
						}
						else {
							T=false;
							break;
						}
					}
					else {
						if(l[p+1]==l[59]) {
							p++;
							l[p]=c;
							q[c-'a']=1;
						}
						else if(l[p-1]==l[59]) {
							p--;
							l[p]=c;
							q[c-'a']=1;
						}
						else {
							T=false;
							break;
						}
					}
				}
			}
			StringBuilder a=new StringBuilder();
			for(char A:l) {
				if(A!=l[59]) {
					a.append(A);
				}
			}
			for(int i=0;i<26;i++) {
				if (q[i]==0) {
					a.append((char)(i+'a'));
				}
			}
			if(T) {
				pw.println("YES");
				pw.println(a);
			}
			else {
				pw.println("NO");
			}
		}
		
		
		
		
		pw.close();
	}
 
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
			
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
 
		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
	}
	static class pair implements Comparable<pair>  {
		int x;
		int y;
		public pair(int x,int y) {
			this.x=x;
			this.y=y;
		}
		public String toString(){
			return x+" "+y;
		}
		public int compareTo(pair other) {
			if(this.x==other.x) {
				return this.y-other.y;
			}
			else {
				return this.x-other.x;
			}
		}
	}
 
}