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

public class B {

	static boolean[][] adj;
	static boolean[] visited;
	static ArrayList<Integer> ans;

	static boolean dfs(int u) {
		visited[u] = true;
		ans.add(u);
		int v = -1;
		int cnt = 0;
		for (int i = 0; i < 26; i++)
			if (adj[u][i] && !visited[i]) {
				cnt++;
				v = i;
			}
		if (cnt > 1)
			return false;
		if (cnt == 0)
			return true;
		return dfs(v);

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int tc = sc.nextInt();
		out: while (tc-- > 0) {
			char[] s = sc.next().toCharArray();
			adj = new boolean[26][26];
			int n = s.length;
			for (int i = 0; i + 1 < n; i++) {
				int u = s[i] - 'a', v = s[i + 1] - 'a';
				adj[u][v] = adj[v][u] = true;
			}
			boolean[] done = new boolean[26];

			for (int i = 0; i < 26; i++) {
				int cnt = 0;
				for (int j = 0; j < 26; j++)
					if (adj[i][j])
						cnt++;
				if (cnt > 2) {
					out.println("NO");
					continue out;
				}
				if (cnt == 0)
					done[i] = true;
			}
			boolean yes = n == 1;
			for (int i = 0; i < 26; i++) {
				visited = new boolean[26];
				ans = new ArrayList();
				if (!done[i]) {
					boolean ok = dfs(i);
					if (ok) {
						yes = true;
						break;
					}
				}
			}
			if (!yes)
				out.println("NO");
			else {
				out.println("YES");
				for (int x : ans)
					out.print((char) (x + 'a'));
				for (int i = 0; i < 26; i++)
					if (done[i])
						out.print((char) (i + 'a'));
				out.println();
			}
		}
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}