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.*;


public class Main {
    static 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') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                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();
        }
    }

	static String dfs(int i,ArrayList<Character> al[],boolean vis[]) {
	    String cur="";
	    cur+=(char)(i+'a');
	    vis[i]=true;
	    for(char ch:al[i]){
	        if(vis[ch-'a']==false)
	        cur+=dfs(ch-'a',al,vis);
	    }
	    return cur;
	    
	}

	public static void main(String[] args) throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	//	Reader sc=new Reader();
		PrintWriter out=new PrintWriter(System.out);
		int t = Integer.parseInt(in.readLine());
		outer:while(t-->0) {
	   String str = in.readLine();
	    int n=str.length();
	    if (n == 1) {
				out.println("YES");
				for (int i=0; i<26; i++) {
					out.print((char)(i + 'a'));
				}
				out.println();
			
			}
			else {
			
	    ArrayList<Character> al[]=new ArrayList[26];
	    
	    for (int i=0; i<26; i++) {
			al[i]=new ArrayList<Character>();
			}
			
	    for(int i=0;i<n;i++) {
	        if(i==0) {
	            if(!al[(int)(str.charAt(i)-'a')].contains(str.charAt(i+1)))
	            al[(int)(str.charAt(i)-'a')].add(str.charAt(i+1));
	        }
	        else if(i==str.length()-1) {
	            if(!al[(int)(str.charAt(i)-'a')].contains(str.charAt(i-1)))
	            al[(int)(str.charAt(i)-'a')].add(str.charAt(i-1));
	        }
	        else {
	            if(!al[(int)(str.charAt(i)-'a')].contains(str.charAt(i+1)))
	            al[(int)(str.charAt(i)-'a')].add(str.charAt(i+1));
	            if(!al[(int)(str.charAt(i)-'a')].contains(str.charAt(i-1)))
	            al[(int)(str.charAt(i)-'a')].add(str.charAt(i-1));
	        }
	    }
	    
	    boolean flag=false;
	    for(int i=0;i<26;i++) {
	        if(al[i].size()>=3) {
	          out.println("NO");
					continue outer;
	        }
	        if (al[i].size() == 1) {
					flag=true;
				}
	    }
	    if(!flag)
	    out.println("NO");
	    else {
	        String res="";
	        boolean vis[]=new boolean[26];
	        for(int i=0;i<26;i++) {
	            if(al[i].size()==1) {
	                res+=dfs(i,al,vis);
	                break;
	            }
	        }
	        
	        for(int i=0;i<26;i++) {
	            if(al[i].size()==0) {
	                res+=(char)(i+'a');
	            }
	        }
	        out.println("YES");
	        out.println(res);
	    }
			}
		}
		
		out.flush();
		out.close();
	}
}