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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashSet;
import java.util.ArrayList;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int t =fr.nextInt() ,n ,i ,j ,k ,l ,kb[] =new int[26] ;	String s ;	
 		ArrayList<HashSet<Integer>> ds =new ArrayList<>() ;	boolean mrk[] ;
 		while (t-->0) {
 			s =fr.next() ;	n =s.length() ;	mrk =new boolean[26] ;
 			for (i =0 ; i<26 ; ++i)	ds.add(new HashSet<>()) ;
 			
 			if (n==1)	op.println("YES\nabcdefghijklmnopqrstuvwxyz") ;
 			else {
 				ds.get(s.charAt(0)-97).add(s.charAt(1)-97) ;
 				for (i =1 ; i+1<n ; ++i) {
 					j =s.charAt(i)-97 ;	k =s.charAt(i+1)-97 ;	l =s.charAt(i-1)-97 ;
 					ds.get(j).add(k) ;	ds.get(j).add(l) ;
 				}
 				ds.get(s.charAt(i)-97).add(s.charAt(i-1)-97) ;	j =k =0 ;
 				for (i =0 ; i<26 ; ++i) {
 					if (ds.get(i).size()==1)	++j ;
 					if (ds.get(i).size()>2)	++k ;	
 				}
 				if (k!=0 || j==0)	op.println("NO") ; 
 				else {
 					op.println("YES") ;	i =-1 ;
 					for (j =0 ;  j<26 ; ++j) {
 						if (ds.get(j).size()==1)	break;
 					}
 					kb[++i] =j ;	mrk[j] =true ;
 					while (!ds.get(j).isEmpty()) {
 						for (int c : ds.get(j)) {
 							k =c ;	break;
 						}
 						kb[++i] =k ;	mrk[k] =true ;	ds.get(j).remove(k) ;	ds.get(k).remove(j) ;
 						j =k ;
 					}
 					for (j =0 ; j<26 ; ++j) {
 						if (!mrk[j])	kb[++i] =j ;
 					}
 					for (i =0 ; i<26 ; ++i)	op.print((char)(kb[i]+97)) ;
 					op.println() ;
 				}
 			}
 			ds.clear() ;
 		}
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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