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.*;
import java.util.*;
import static java.lang.Integer.*;
public class D3 {

	public static void main(String[] args) throws IOException{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out=new PrintWriter(System.out);
		
//		int t=1;
		int t=parseInt(in.readLine());
		
		while(t-->0) {
			Set<Character> alist[]=new HashSet[26];
			for(int i=0;i<26;i++)
				alist[i]=new HashSet<>();
			
			String s=in.readLine();
			StringBuilder sb=new StringBuilder("");
			if(s.length()==1) {
				for(char ch='a';ch<='z';ch++)
					sb.append(ch);
				out.println("YES");
				out.println(sb);
				out.flush();
				continue;
			}
			int n=s.length();
			for(int i=0;i<n-1;i++) {
				char curr=s.charAt(i);
				char next=s.charAt(i+1);
				alist[curr-'a'].add(next);
				alist[next-'a'].add(curr);
			}
			
			int f=0; int ptr=0;
			Set<Character> st=new HashSet<>();
			LinkedList<Character> ans=new LinkedList<>();
			Queue<Character> q=new LinkedList<>();
			for(int i=0;i<26;i++) {
				if(alist[i].size()>2) {
					f=1;
					break;
				}
				if(alist[i].size()==1) {
					ptr++;
					if(ptr==1) {
						for(char x:alist[i]) {
							q.add(x);
						}
						ans.add((char)(i+97));
						st.add((char)(i+97));						
					}
				}
			}
			if(ptr!=2) {
				f=1;
			}
//			out.println(ans);
//			out.println(st);
			while(f==0 && !q.isEmpty()) {
				char curr=q.poll();
				st.add(curr);
				for(char x:alist[curr-'a']) {
					if(!st.contains(x)) {
						q.add(x);
					}
					else {
						if(st.contains(x)) {
							if(ans.getLast()==(x)) {
								ans.addLast(curr);
								continue;
							}
							else if(ans.getFirst()==(x)) {
								ans.addFirst(curr);
								continue;
							}
						}
					}
				}
			}
			if(f==1) {
				out.println("NO");out.flush();
				continue;
			}
//			out.println(st);
			for(int i=0;i<ans.size();i++)
				sb.append(ans.get(i));
			
			for(char ch='a';ch<='z';ch++) {
				if(st.contains(ch))
					continue;
				sb.append(ch);
			}
			out.println("YES");
			out.println(sb);
			out.flush();
		}
		
	}
}


class Reader
{
   final private int BUFFER_SIZE = 1 << 16;
   private DataInputStream din;
   private byte[] buffer;
   private int bufferPointer, bytesRead;

   public Reader()
   {
       din = new DataInputStream(System.in);
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public Reader(String file_name) throws IOException
   {
       din = new DataInputStream(new FileInputStream(file_name));
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public String readLine() throws IOException
   {
       byte[] buf = new byte[64]; // line length
       int cnt = 0, c;
       while ((c = read()) != -1)
       {
           if (c == '\n')
               break;
           buf[cnt++] = (byte) c;
       }
       return new String(buf, 0, cnt);
   }

   public int nextInt() throws IOException
   {
       int ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
       boolean neg = (c == '-');
       if (neg)
           c = read();
       do
       {
           ret = ret * 10 + c - '0';
       }  while ((c = read()) >= '0' && c <= '9');

       if (neg)
           return -ret;
       return ret;
   }

   public long nextLong() throws IOException
   {
       long ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
       boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       }
       while ((c = read()) >= '0' && c <= '9');
       if (neg)
           return -ret;
       return ret;
   }

   public double nextDouble() throws IOException
   {
       double ret = 0, div = 1;
       byte c = read();
       while (c <= ' ')
           c = read();
       boolean neg = (c == '-');
       if (neg)
           c = read();

       do {
           ret = ret * 10 + c - '0';
       }
       while ((c = read()) >= '0' && c <= '9');

       if (c == '.')
       {
           while ((c = read()) >= '0' && c <= '9')
           {
               ret += (c - '0') / (div *= 10);
           }
       }

       if (neg)
           return -ret;
       return ret;
   }

   private void fillBuffer() throws IOException
   {
       bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
       if (bytesRead == -1)
           buffer[0] = -1;
   }

   private byte read() throws IOException
   {
       if (bufferPointer == bytesRead)
           fillBuffer();
       return buffer[bufferPointer++];
   }

   public void close() throws IOException
   {
       if (din == null)
           return;
       din.close();
   }
}