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
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InputMismatchException;

public class C {
	public static ArrayList<Integer>[] adj;
	public static StringBuilder ans;
	public static int[] vis;
	public static int flag;

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		InputReader s = new InputReader(System.in);
		PrintWriter p = new PrintWriter(System.out);
		int t = s.nextInt();
		while (t-- > 0) {
			ans = new StringBuilder();
			adj = new ArrayList[26];
			vis = new int[26];
			flag = 0;
			HashMap<Integer, Integer> map = new HashMap<>();
			for (int i = 0; i < 26; i++) {
				adj[i] = new ArrayList<>();
			}
			String str = s.nextLine();
			if (str.length() == 1) {
				p.println("YES");
				for (int i = 0; i < 26; i++) {
					if (!map.containsKey(i)) {
						ans.append((char) (i + 'a'));
					}
				}
				p.println(ans);
				continue;
			}
			char[] arr = str.toCharArray();
			for (int i = 0; i < arr.length - 1; i++) {
				int src = arr[i] - 'a';
				int dest = arr[i + 1] - 'a';
				map.put(src, 1);
				map.put(dest, 1);
				if (!adj[src].contains(dest))
					adj[src].add(dest);
				if (!adj[dest].contains(src))
					adj[dest].add(src);
			}
			int r1 = 0;
			for (int i = 0; i < adj.length; i++) {
				if (adj[i].size() == 1) {
					r1 = 1;
					dfs(i);
					break;
				}
			}
			if (flag == 1 || r1 == 0) {
				p.println("NO");
				continue;
			}
			p.println("YES");
			for (int i = 0; i < 26; i++) {
				if (!map.containsKey(i)) {
					ans.append((char) (i + 'a'));
				}
			}
			p.println(ans);
		}
		p.flush();
		p.close();
	}

	public static void dfs(int i) {
		if (vis[i] == 1) {
			flag = 1;
			return;
		}
		vis[i] = 1;
		ArrayList<Integer> nbrs = adj[i];
		ans.append((char) ('a' + i));
		if (nbrs.size() > 1) {
			flag = 1;
			return;
		}
		for (int j = 0; j < nbrs.size(); j++) {
			int nbr = nbrs.get(j);
			ArrayList<Integer> temp = adj[nbr];
			for (int k = 0; k < temp.size(); k++) {
				if (temp.get(k) == i) {
					temp.remove(k);
				}
			}
			dfs(nbr);
		}
	}

	public static int root(int i, int[] root) {
		while (root[i] != i) {
			root[i] = root[root[i]];
			i = root[i];
		}
		return i;
	}

	public static int union(int src, int dest, int[] size, int[] root) {
		int root_A = root(src, root);
		int root_B = root(dest, root);
		if (root_A == root_B) {
			return -1;
		}
		if (size[root_A] < size[root_B]) {
			root[root_A] = root[root_B];
			size[root_B] += size[root_A];
		} else {
			root[root_B] = root[root_A];
			size[root_A] += size[root_B];
		}
		return 1;
	}

	public static int onesComplement(int n) {
		int number_of_bits = (int) (Math.floor(Math.log(n) / Math.log(2))) + 1;
		return ((1 << number_of_bits) - 1) ^ n;
	}

	static class Pair<T, V> {
		T first; // maximum distance Node
		V second; // distance of maximum distance node

		// Constructor
		Pair(T first, V second) {
			this.first = first;
			this.second = second;
		}
	}

	public static ArrayList Divisors(long n) {
		ArrayList<Long> div = new ArrayList<>();

		for (long i = 1; i <= Math.sqrt(n); i++) {
			if (n % i == 0) {
				div.add(i);

				if (n / i != i)
					div.add(n / i);
			}
		}
		return div;
	}

	public static int BinarySearch(long[] a, long k) {
		int n = a.length;
		int i = 0, j = n - 1;
		int mid = 0;

		if (k < a[0])
			return 0;
		else if (k >= a[n - 1])
			return n;
		else {
			while (j - i > 1) {
				mid = (i + j) / 2;

				if (k >= a[mid])
					i = mid;
				else
					j = mid;
			}
		}

		return i + 1;
	}

	public static long GCD(long a, long b) {
		if (b == 0)
			return a;
		else
			return GCD(b, a % b);
	}

	public static long LCM(long a, long b) {
		return (a * b) / GCD(a, b);
	}

	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

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

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

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

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

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class CodeX {
		public static void sort(long arr[]) {
			merge_sort(arr, 0, arr.length - 1);
		}

		private static void merge_sort(long A[], long start, long end) {
			if (start < end) {
				long mid = (start + end) / 2;
				merge_sort(A, start, mid);
				merge_sort(A, mid + 1, end);
				merge(A, start, mid, end);
			}

		}

		private static void merge(long A[], long start, long mid, long end) {
			long p = start, q = mid + 1;
			long Arr[] = new long[(int) (end - start + 1)];
			long k = 0;

			for (int i = (int) start; i <= end; i++) {
				if (p > mid)
					Arr[(int) k++] = A[(int) q++];

				else if (q > end)
					Arr[(int) k++] = A[(int) p++];

				else if (A[(int) p] < A[(int) q])
					Arr[(int) k++] = A[(int) p++];

				else
					Arr[(int) k++] = A[(int) q++];
			}
			for (int i = 0; i < k; i++) {
				A[(int) start++] = Arr[i];
			}

		}

	}

}