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:
//package com.pb.codeforces.practice;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class CF1303C {
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
	
	public static StringBuilder ans = new StringBuilder();
	
	public static boolean dfs(char u, HashSet<Character> used, HashSet<Character>[] adj,char p) {
		ans.append(u);
		used.add(u);
		for(char v : adj[u-'a']) {
			if(v == p) continue;
			if(used.contains(v)) return false;
			if(!dfs(v, used, adj, u)) return false;
		}
		return true;
	}
	
	public static void main(String[] args) {
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int t = in.nextInt();
		while(t-- > 0) {
			char[] carr = in.next().toCharArray();
			if(carr.length <= 2) {
				StringBuilder ans = new StringBuilder();
				HashSet<Character> used = new HashSet<Character>();
				for(int i=0; i<carr.length; i++) {
					used.add(carr[i]);
					ans.append(carr[i]);
				}
				out.println("YES");
				for(int i=0; i<26; i++) {
					char ch = (char)('a'+i);
					if(!used.contains(ch))
						ans.append(ch);
				}
				out.println(ans);
			}else {
				HashSet<Character>[] adj = new HashSet[26];
				for(int i=0; i<adj.length; i++)
					adj[i] = new HashSet<Character>();
				for(int i=1; i<carr.length; i++) {
					char ch = carr[i]; char pch = carr[i-1];
					adj[ch-'a'].add(pch);
					adj[pch-'a'].add(ch);
				}
				boolean p = true;
				char st = 'a';
				int ocnt = 0;
				for(int i=0; i<adj.length; i++) {
					if(adj[i].size() > 2) { p = false; break; }
					if(adj[i].size() == 1) { st = (char)('a'+i);  ocnt++; }
				}
				if(ocnt != 2)
					p = false;
				if(p) {
					HashSet<Character> used = new HashSet<Character>();
					ans.delete(0,  ans.length());
					p = dfs(st,used,adj,'*');
					if(!p)
						out.println("NO");
					else {
						out.println("YES");
						for(int i=0; i<26; i++) {
							char ch = (char)('a'+i);
							if(!used.contains(ch))
								ans.append(ch);
						}
						out.println(ans);
					}
				}else {
					out.println("NO");
				}
			}
		}
		out.flush();
		out.close();
	}
}