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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Indrajit Sinha
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		CPerfectKeyboard solver = new CPerfectKeyboard();
		int testCount = Integer.parseInt(in.next());
		for (int i = 1; i <= testCount; i++)
			solver.solve(i, in, out);
		out.close();
	}

	static class CPerfectKeyboard {
		TreeSet<Integer>[] tree;
		boolean[] vis;
		PrintWriter out;
		InputReader in;
		int[] val;
		int cc = 0;
		String fin;

		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int t, i, j, tt, k;
			this.out = out;
			this.in = in;
			String ss = in.next();
			if (ss.length() == 1) {
				pn("YES");
				for (i = 0; i < 26; i++) {
					out.print((char) (i + 97));
				}
				out.println();
				return;
			}
			TreeSet<Integer> ts = new TreeSet<>();
			ts.add(ss.charAt(0) - 'a');
			val = new int[26];
			Arrays.fill(val, -1);
			cc = 0;
			initT(26);
			for (i = 0; i < ss.length() - 1; i++) {
				int ch = ss.charAt(i) - 'a';
				int ch1 = ss.charAt(i + 1) - 'a';
				ts.add(ch1);
				tree[ch].add(ch1);
				tree[ch1].add(ch);
			}
			for (Integer it : ts) {
				if (!vis[it]) {
					dfs(it);
					cc++;
				}
			}
			String xo = "";
			boolean fl = true;
			TreeSet<Integer> an = new TreeSet<>();
			fin = "";
			for (i = 0; i < cc; i++) {
				int tot = 0;
				int one = 0;
				int ola = -1;
				int two = 0;
				for (j = 0; j < 26; j++) {
					if (val[j] == i) {
						if (tree[j].size() == 1) {
							one++;
							ola = j;
						}
						if (tree[j].size() == 2)
							two++;
						tot++;
					}
				}
				if (tot == 1) {
					an.add(ola);
					continue;
				}
				if (one != 2 || two != (tot - 2)) {
					fl = false;
					break;
				}
				an.add(ola);
			}
			if (!fl) {
				pn("NO");
				return;
			}
			pn("YES");
			Arrays.fill(vis, false);
			for (Integer it : an) {
				dfs1(it);
			}
			for (i = 0; i < 26; i++) {
				if (val[i] == -1)
					fin += (char) (i + 97);
			}
			pn(fin);
		}

		void dfs1(int x) {
			vis[x] = true;
			fin += (char) (x + 97);
			for (Integer it : tree[x]) {
				if (!vis[it])
					dfs1(it);
			}
		}

		void dfs(int x) {
			vis[x] = true;
			val[x] = cc;
			for (Integer it : tree[x]) {
				if (!vis[it])
					dfs(it);
			}
		}

		void pn(String zx) {
			out.println(zx);
		}

		void initT(int n) {
			vis = new boolean[n];
			tree = new TreeSet[n];
			for (int i = 0; i < n; i++) {
				tree[i] = new TreeSet<>();
			}
		}

	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (numChars == -1) {
				throw new UnknownError();
			}
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new UnknownError();
				}
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));

			return res.toString();
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
}