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 io2 {

	static long mod = (long) 1e9 + 7;
	static boolean multipleTC = true;

	void solve(int TC) throws Exception {
		String s = in.n();
		String sb = s.charAt(0) + "";
		HashSet<Character> hs = new HashSet<>();
		hs.add(s.charAt(0));
		for (int i = 1; i < s.length(); i++) {
			if (hs.contains(s.charAt(i))) {
				char ch = s.charAt(i - 1);
				int idx = sb.indexOf(s.charAt(i));
				boolean b = false;
				if (idx != 0 && sb.charAt(idx - 1) == ch) {
					b = true;
				}
				if (idx != sb.length() - 1 && sb.charAt(idx + 1) == ch) {
					b = true;
				}
				if (!b) {
					pl("NO");
					return;
				}
				continue;
			}
			char ch = s.charAt(i - 1);
			if (sb.charAt(0) != ch && sb.charAt(sb.length() - 1) != ch) {
				pl("NO");
				return;
			}
			if (sb.charAt(0) == ch) {
				sb = s.charAt(i) + "" + sb;
			} else if (sb.charAt(sb.length() - 1) == ch) {
				sb = sb + s.charAt(i);
			}
			hs.add(s.charAt(i));
		}
		for (char ch = 'a'; ch <= 'z'; ch++) {
			if (!hs.contains(ch))
				sb = sb + ch + "";
		}
		pl("YES");
		pl(sb);
	}

	void hold(boolean b) throws Exception {
		if (!b)
			throw new Exception("@author : ashraf101");
	}

	DecimalFormat df = new DecimalFormat("0.00000000000");
	FastReader in;
	PrintWriter out;

	void run() throws Exception {
		in = new FastReader();
		out = new PrintWriter(System.out);
		int T = (multipleTC) ? in.ni() : 1;
		pre();
		for (int t = 1; t <= T; t++)
			solve(t);
		out.flush();
		out.close();
	}

	public static void main(String[] args) throws Exception {
		new io2().run();
	}

	void pre() throws Exception {
	}

	void p(Object o) {
		out.print(o);
	}

	void pl(Object o) {
		out.println(o);
	}

	void pni(Object o) {
		out.println(o);
		out.flush();
	}

	class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

		public FastReader(String s) throws Exception {
			br = new BufferedReader(new FileReader(s));
		}

		String next() throws Exception {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new Exception(e.toString());
				}
			}
			return st.nextToken();
		}

		String nextLine() throws Exception {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new Exception(e.toString());
			}
			return str;
		}

		int bit(long n) {
			return (n == 0) ? 0 : (1 + bit(n & (n - 1)));
		}

		String n() throws Exception {
			return in.next();
		}

		String nln() throws Exception {
			return in.nextLine();
		}

		int ni() throws Exception {
			return Integer.parseInt(in.next());
		}

		long nl() throws Exception {
			return Long.parseLong(in.next());
		}

		double nd() throws Exception {
			return Double.parseDouble(in.next());
		}
	}
}