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.*;
import static java.lang.Math.*;
public class Scanner_ {
    //global methods
    static class MyReader {
        BufferedReader br;
        StringTokenizer st;

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

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

        int ni() {
            return Integer.parseInt(ne());
        }

        long nl() {
            return Long.parseLong(ne());
        }

        double nd() {
            return Double.parseDouble(ne());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) {
        new Thread(null, null, "Rahsut", 1 << 25) {
            public void run() {
                try {
                    Freak();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static long modPow(long x, long p, long m) {
        if (p == 0)
            return 1;
        if (p % 2 == 0)
            return modPow((x * x) % m, p >> 1, m) % m;
        return x * (modPow(x, p - 1, m) % m) % m;
    }
    static long mul(long a, long b, long m) {
        a %= m;
        b %= m;
        return (a * b) % m;
    }
    static long gcd(long a,long b) {
        if(b%a==0)
            return a;
        return gcd(b%a,a);
    }
    static long lcm(long a, long b) {
        a/=gcd(a,b);
        return a*b;
    }
    public static class Pair implements Comparable<Pair> {
        long x, y;
        Pair(long x, long y) {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Pair o) {
            if (x != o.x)
                return (int)x - (int)o.x;
            return (int)y - (int)o.y;
        }

        public String toString() {
            return x + " " + y;
        }
    }

    //global variables
    static MyReader sc = new MyReader();
    static StringBuilder sb = new StringBuilder();
    static PrintWriter pw = new PrintWriter(System.out, true);
    static int dir1[][]= {{1,0},{-1,0},{0,1},{0,-1}},n,q,t;
    static int dir2[][] ={{1,-1},{-1,1},{1,1},{-1,-1}};
    static int dp[][], mod = (int)1e9 + 7;
    static char arr[];
    static void Freak() throws IOException {
        int t = sc.ni();
        while(t-->0)
        {
            arr = sc.ne().toCharArray();
            n = arr.length;
            ArrayList<Character> al = new ArrayList<>();
            al.add(arr[0]);
            int cur =0;
            boolean bool = false;
            Set<Character> set = new HashSet<>();
            set.add(arr[0]);
            for(int i =1;i<n;i++) {
                if(cur-1 >=0 && arr[i]==al.get(cur-1)) {
                    cur--;
                }else if(cur+1<al.size() && arr[i]==al.get(cur+1))
                    cur++;
                else {
                    if(cur+1==al.size() && !set.contains(arr[i])) {
                        al.add(arr[i]);
                        cur++;
                        set.add(arr[i]);
                    }else if(cur-1<0 && !set.contains(arr[i])) {
                        al.add(0,arr[i]);
                        cur =0;
                        set.add(arr[i]);
                    } else {
                        bool = true;
                        break;
                    }
                }
            }
            if(bool)
                sb.append("NO\n");
            else {
                sb.append("YES\n");
                for(char ch : al) {
                    sb.append(ch);
                }
                for(int i =0;i<26;i++) {
                    char x = (char)('a'+i);
                    if(!set.contains(x))
                        sb.append(x);
                }
                sb.append("\n");

            }
        }
        pw.println(sb);
        pw.flush();
        pw.close();
    }
}