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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
 
import javax.sound.sampled.SourceDataLine;
 
public class div {
	static ArrayList<Integer> primes;
	static int[] isComposite;
 
	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();
 
		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}
 
	static ArrayList<Integer> a[];
	static boolean f = true;
	static boolean visited[];
	static HashSet<Integer> h = new HashSet<>();
 
	static String make(int i, int d) {
		String	s = (char) ('a' + i) + "";
		visited[i] = true;
		if (a[i].size() == 2) {
			h.add(i);
			h.add(a[i].get(0));
			h.add(a[i].get(1));
			String r = "";
			String l = "";
			if (!visited[a[i].get(0)]) {
				visited[a[i].get(0)] = true;
				if (d == 1)
					r = make(a[i].get(0), 1);
				else
					r = make(a[i].get(0), -1);
			}
			if (!visited[a[i].get(1)]) {
				visited[a[i].get(1)] = true;
				if (d == -1)
					l = make(a[i].get(1), -1);
				else
					l = make(a[i].get(1), 1);
			}
			if (d == -1)
				s = r + l + s;
			if (d == 1)
				s = s + l + r;
			if (d == 0)
				s = r + s + l;
		}
		if (a[i].size() == 1) {
			h.add(i);
			h.add(a[i].get(0));
			String r = "";
			if (!visited[a[i].get(0)]) {
				visited[a[i].get(0)] = true;
				if (d == -1)
					r = make(a[i].get(0), -1);
				else
					r = make(a[i].get(0), 1);
 
			}
			if (d == -1)
				s = r + s;
			if (d == 1)
				s = s + r;
			if (d == 0)
				s = s + r;
		}
		return s;
	}
 
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		int t = Integer.parseInt(br.readLine());
		while (t-- > 0) {
			char c[] = br.readLine().toCharArray();
			a = new ArrayList[26];
			for (int i = 0; i < a.length; i++) {
				a[i] = new ArrayList<>();
			}
			HashSet<Character> w = new HashSet<>();
			HashSet<Character> z[] = new HashSet[26];
			for (int i = 0; i < z.length; i++) {
				z[i]=new HashSet<>();
			}
			for (int i = 0; i < c.length; i++) {
				HashSet<Character> h1 = new HashSet<>();
				z[c[i]%'a'].add(c[i]);
				for (int j = 0; j < c.length; j++) {
					if (!z[c[i]%'a'].contains(c[j])
							&& ((j != 0 && c[j - 1] == c[i]) || (j != c.length - 1 && c[j + 1] == c[i]))) {
						z[c[i]%'a'].add(c[j]);
						a[c[i] % 'a'].add(c[j] % 'a');
					}
				}
			}
			h = new HashSet<>();
			visited = new boolean[26];
			
			String sol = "";
			for (int i = 0; i < a.length; i++) {
				if (!h.contains(i)) {
					sol += make(i, 0);
				}
			}
			f=true;
			for (int i = 0; i < c.length; i++) {
				for (int j = 0; j < c.length; j++) {
					if((j != 0 && c[j] == c[i] ) ) {
						char x=c[j-1];
						for (int j2 = 0; j2 <sol.length() ; j2++) {
							if(sol.charAt(j2)==c[i]) {
								if((j2 == 0?true:false || x != sol.charAt(j2-1)) && (j2 == sol.length() - 1?true:false || x != sol.charAt(j2+1))) {
									f=false;
					//				if(j2 != 0 && x == sol.charAt(j2-1))
			//							System.out.println(x+" "+sol.charAt(j2-1)+" l");
								}
							}
						}
					}
					if((j != c.length-1 && c[j] == c[i]) ) {
						char x=c[j+1];
				//		System.out.println(x+" "+c[i]);
						for (int j2 = 0; j2 <sol.length() ; j2++) {
							if(sol.charAt(j2)==c[i]) {
								if((j2 == 0?true:false || x != sol.charAt(j2-1)) && (j2 == sol.length() - 1?true:false || x != sol.charAt(j2+1)))
									f=false;
							}
						}
					}
				}
				
			}
			
			if (f) {
				pw.println("YES");
				pw.println(sol);
			} else
				pw.println("NO");
		}
 
		pw.flush();
	}
 
	static class tri {
		long d;
		int v;
		int t;
 
		public tri(long q, int w, int r) {
			d = q;
			v = w;
			t = r;
		}
 
		static float power(float x, int y) {
			float temp;
			if (y == 0)
				return 1;
			temp = power(x, y / 2);
 
			if (y % 2 == 0)
				return temp * temp;
			else {
				if (y > 0)
					return x * temp * temp;
				else
					return (temp * temp) / x;
			}
		}
	}
}