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:
// Working program using Reader Class 
import java.io.*; 
// import java.io.FileInputStream; 
// import java.io.IOException; 
// import java.io.InputStreamReader; 
// import java.util.Scanner; 
import java.util.*; 

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') 
					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(); 
		} 
	} 
	public static void main(String args[])throws IOException
	{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        while(t-->0)
        {
            String s = br.readLine();
            System.out.println(getAns(s));
        }
	}
	static String getAns(String s)
	{
	    HashSet<Integer> set = new HashSet<>();
	    int left[] = new int[26];
        int right[] =new int[26];
        Arrays.fill(left,-1);
        Arrays.fill(right,-1);
        int prev = -1;
        boolean vis[] = new boolean[26];
        for(int i = 0;i<s.length();i++)
        {
            int c =s.charAt(i)-'a';
            set.add(c);
            vis[c] = true;
            if(!add(prev,left,c,right))return "NO";
            if(!add(c,left,prev,right))return "NO";
            prev = c;
        }
        // System.out.println("sffd");
        String s1 = "";
        for(int i = 0;i<26;i++)
        {
            if(left[i]!=-1&&right[i]==-1||left[i]==-1&&right[i]!=-1||vis[i]&&left[i]==-1&&right[i]==-1)
            {
                int p = Math.max(left[i],right[i]);
                if(p==-1)
                {
                    s1 =(char)(i+'a')+"";
                    if(s1.length()==set.size())
                    break;
                }
                // System.out.println(p+" "+(char)(i+'a'));
                s1 = (char)(i+'a')+DFS(p,i,left,right);
                if(s1.length()==set.size())
                break;
            }
        }
        if(s1.length()!=set.size())
        return "NO";
        for(int i = 0;i<26;i++)
        if(!vis[i])
        s1 += (char)(i+'a'); 
        if(s1.length()<26)
        return "NO";
        return "YES\n"+s1;
	}
	static String DFS(int i, int p , int left[], int right[])
	{
	    int c = left[i];
	    int d = right[i];
	    if(left[i]==-1||right[i]==-1)
	    {
	        return (char)(i+'a')+"";
	    }
	    if(left[i]==p)
	    {
	        return (char)(i+'a')+""+DFS(right[i],i,left,right);
	    }
	    else
	    {
	        return (char)(i+'a')+""+DFS(left[i],i,left,right);
	    }
	}
	static boolean add(int c, int left[], int prev,int right[])
	{
	    if(c==-1)
	    return true;
	    if(left[c] ==prev || right[c] == prev)
	    return true;
	    if(left[c]==-1)
	    {
	        left[c] = prev;
	        return true;
	    }
	    if(right[c] == -1)
	    {
	        right[c] = prev;
	        return true;
	    }
	    return false;
	}
}