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.*;
import java.text.*;

public class C1303 {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int t = sc.nextInt();
		while (t-- > 0) {
			char[] arr = sc.next().toCharArray();
			TreeSet<Integer>[] adjList = new TreeSet[26];
			for (int i = 0; i < adjList.length; i++) {
				adjList[i] = new TreeSet<Integer>();
			}
			for (int i = 1; i < arr.length; i++) {
				adjList[arr[i - 1] - 'a'].add(arr[i] - 'a');
				adjList[arr[i] - 'a'].add(arr[i - 1] - 'a');
			}
			StringBuilder sb = new StringBuilder();
			boolean valid = true;
			boolean[] vis = new boolean[26];
			loop: for (int i = 0; i < adjList.length; i++) {
				if (adjList[i].size() == 0) {
					sb.append((char) ('a' + i));
					vis[i] = true;
				} else if (adjList[i].size() == 1) {
					if (vis[i])
						continue;
					Queue<Integer> q = new LinkedList<Integer>();
					q.add(i);
					vis[i] = true;
					while (!q.isEmpty()) {
						int cur = q.poll();
						sb.append((char) (cur + 'a'));
						if (adjList[cur].size() > 2) {
							valid = false;
							break loop;
						}
						for (int x : adjList[cur]) {
							if (!vis[x]) {
								q.add(x);
								vis[x] = true;
							}
						}

					}

				} else if (adjList[i].size() > 2) {
					valid = false;
					break;
				}
			}
			if (valid && sb.toString().length()==26 ) {
				pw.println("YES");
				pw.println(sb);
			} 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 {
			return Double.parseDouble(next());
		}

		public int[] nextIntArr(int n) throws IOException {
			int[] arr = new int[n];
			for (int i = 0; i < arr.length; i++)
				arr[i] = nextInt();
			return arr;
		}

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

	}
}