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:
/*
javac c.java && java c
*/

import java.io.*;
import java.util.*;

public class c {
	public static void main(String[] args) { new c(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int t;
	char[] s;
	int[] deg;
	boolean[] adj[];

	c() {
		t = in.nextInt();
		while (t-- > 0) {
			s = in.next().toCharArray();
			
			deg = new int[26];
			adj = new boolean[26][26];

			int n = s.length;
			for (int i = 0; i < n; i++) {
				int ch = s[i] - 'a';
				if (i > 0) {
					int p = s[i - 1] - 'a';
					if (!adj[ch][p]) {
						adj[ch][p] = true;
						adj[p][ch] = true;
						deg[ch]++;
						deg[p]++;
					}
				}
				if (i < n - 1) {
					int x = s[i + 1] - 'a';
					if (!adj[ch][x]) {
						adj[ch][x] = true;
						adj[x][ch] = true;
						deg[ch]++;
						deg[x]++;
					}
				}
			}

			int max = 0;
			for (int i = 0; i < 26; i++)
				max = max(max, deg[i]);
			boolean all = true;
			for (int i = 0; i < 26; i++)
				all &= ((deg[i] & 1) == 0);
			if (max > 2) 
				out.println("NO");
			else if (all && n != 1)
				out.println("NO");
			else {
				char[] kb = new char[26];
				if (n == 1) {
					for (int i = 0; i < 26; i++)
						kb[i] = (char)('a' + i);
				}
				else {
					int ptr = 0;
					boolean[] vis = new boolean[26];

					int st = -1;
					for (int i = 0; i < 26; i++)
						if ((deg[i] & 1) == 1)
							st = i;

					int cnt = 0;
					for (int i = 0; i < 26; i++)
						if (deg[i] > 0)
							cnt++;

					while (ptr < cnt) {
						kb[ptr++] = (char)('a' + st);
						vis[st] = true;

						for (int i = 0; i < 26; i++)
							if (adj[st][i] && !vis[i]) {
								st = i;
								break;
							}
					}
					for (int i = 0; i < 26; i++)
						if (deg[i] == 0)
							kb[ptr++] = (char)('a' + i);
				}

				out.println("YES");
				out.println(new String(kb));
			}
		}
		out.close();
	}

	
	
	int abs(int x) { return x < 0 ? -x : x; }
	long abs(long x) { return x < 0 ? -x : x; }
	double abs(double x) { return x < 0 ? -x : x; }
	int min(int x, int y) { return x < y ? x : y; }	
	int max(int x, int y) { return x > y ? x : y; }
	long min(long x, long y) { return x < y ? x : y; }	
	long max(long x, long y) { return x > y ? x : y; }
	double min(double x, double y) { return x < y ? x : y; }
	double max(double x, double y) { return x > y ? x : y; }
	int gcd(int x, int y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long gcd(long x, long y) { while (y > 0) { x = y^(x^(y = x)); y %= x; } return x; }
	long lcm(int x, int y) { return ((long) x / gcd(x, y)) * y; }
	long lcm(long x, long y) { return (x / gcd(x, y)) * y; }

	void sort(int[] arr) {
		int sz = arr.length, j;
		Random r = new Random();
		for (int i = 0; i < sz; i++) {
			j = r.nextInt(i + 1);
			arr[i] = arr[j]^(arr[i]^(arr[j] = arr[i]));
		} Arrays.sort(arr);
	}

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}