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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.*;
 
public class A3 {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
    }

    public static void solve(InputReader sc, PrintWriter pw) {
        int i,j=0;
        // int t=1;
        int t=sc.nextInt();
        u:while(t-->0){
            String s=sc.next();
            char ch[]=s.toCharArray();
            int n=s.length();
            int a[][]=new int[26][26];
            int fre[]=new int[26];
            for(i=0;i<n-1;i++){
                int b=ch[i]-'a';
                int c=ch[i+1]-'a';
                if(a[b][c]==0){
                    fre[b]++;
                    fre[c]++;
                }
                a[b][c]=1;
                a[c][b]=1;
            }
            int y=0;
            ArrayList<Integer> ar=new ArrayList<>();
            for(i=0;i<26;i++){
                if(fre[i]>2){
                    pw.println("NO");
                    continue u;
                }
                if(fre[i]==1){
                    ar.add(i);
                    y++;
                }
            }
            if(y==0&&s.length()==1){
                pw.println("YES");
                for(i=0;i<26;i++)
                    pw.print((char)(i+'a'));
                pw.println();
                continue u;
            }
            if(y<2)
                pw.println("NO");
            else if(y>=2){
                pw.println("YES");
                // for()
                // pw.print((char)(ar.get(0)+'a'));
                // for(int j=0;j<26;j++){
                //     if(a[i][j]==0)
                // }
                int g[][]=new int[27][2];
                int vis[]=new int[27];
                for(i=0;i<s.length()-1;i++){
                    int b=ch[i]-'a'+1;
                    int c=ch[i+1]-'a'+1;
                    if(g[b][0]==0){
                        g[b][0]=c;
                    }
                    else if(g[b][0]!=c){
                        g[b][1]=c;
                    }
                    if(g[c][0]==0){
                        g[c][0]=b;
                    }
                    else if(g[c][0]!=b){
                        g[c][1]=b;
                    }
                }
                pw.print((char)(ar.get(0)+'a'));
                int start=ar.get(0);
                int h[]=new int[30];
                h[0]=start;
                // int vis[]=new int[26];
                vis[start]=1;
                // pw.print((char)(start+'a'));
                while(true){
                    int now=g[start+1][0]-1;
                    if(now==-1)
                        break;
                    if(vis[now]==0){
                        // now=g[start][0]-1;
                        pw.print((char)(now+'a'));
                        vis[now]=1;
                        start=now;
                    }
                    else{
                        now=g[start+1][1]-1;
                        if(now==-1)
                            break;
                        // now=g[start][1]-1;
                        pw.print((char)(now+'a'));
                        vis[now]=1;
                        start=now;
                    }
                }
                for(i=0;i<26;i++){
                    if(vis[i]==0){
                        pw.print((char)(i+'a'));
                    }
                }
                pw.println();
            }
        }
    }
 
    static class Pair implements Comparable<Pair>{
        int a;
        int b;
        // int i;
        Pair(int a,int b){
            this.a=a;
 
            this.b=b;
            // this.i=i;
        }   
        public int compareTo(Pair p){
            if(a>p.a)
                return 1;
            if(a==p.a)
                return (b-p.b);
            return -1;
        }
    }
 
    static boolean isPrime(int n) { 
        if (n <= 1) 
            return false; 
        if (n <= 3) 
            return true; 
        if (n % 2 == 0 || n % 3 == 0) 
            return false; 
        for (int i = 5; i * i <= n; i = i + 6) 
            if (n % i == 0 || n % (i + 2) == 0) 
                return false; 
        return true; 
    } 
    static int gcd(int a, int b) { 
        if (b == 0) 
            return a; 
        return gcd(b, a % b);  
    } 
    static long fast_pow(long base,long n,long M){
        if(n==0)
           return 1;
        if(n==1)
        return base;
        long halfn=fast_pow(base,n/2,M);
        if(n%2==0)
            return ( halfn * halfn ) % M;
        else
            return ( ( ( halfn * halfn ) % M ) * base ) % M;
    }
    static long modInverse(long n,long M){
        return fast_pow(n,M-2,M);
    }
 
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
 
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}