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:
/**
 * ******* Created  on 25/2/20 12:43 PM*******
 */

import java.io.*;
import java.util.*;

public class ED82C implements Runnable {

    private static final int MAX = (int) (1E5 + 5);
    private static final int MOD = (int) (1E9 + 7);
    private static final long Inf = (long) (1E14 + 10);

    Set<Integer>[] set = new Set[26];
    private void solve() throws IOException {

        for(int i=0;i<26; i++)
            set[i] = new HashSet<Integer>();
        int t  = reader.nextInt();
        while(t-- >0){
            String s = reader.next();
            int n = s.length();
            for(int i=0;i<26;i++)
                set[i].clear();
            for(int i=0;i+1<n;i++){
                int x =s.charAt(i)-'a';
                int y =s.charAt(i+1)-'a';
                set[x].add(y);
                set[y].add(x);
            }
            boolean flag =true;
            int twos =0, root =-1;
            if(s.length()==1)
                root =1;
            for(int i=0;i<26;i++){
                if(set[i].size()>=3)
                    flag =false;
                if(set[i].size()==2) {
                    twos++;
                }
                if(set[i].size()==1 )
                    root = i;
            }

            if(twos>24 || root ==-1)
                flag = false;
            if(!flag){
                writer.println("NO");
                continue;
            }

            sb = new StringBuilder();
            for(int i=0;i<26;i++)
                used[i]=-1;
            dfs(root);
            for(int i=0;i<26;i++)
                if(used[i]==-1)
                    sb.append((char) (i+'a') );
            writer.println("YES");
            writer.println(sb.toString());
        }
    }
    int[] used = new int[26];
    StringBuilder sb  =new StringBuilder();
    private void dfs(int v) {
        if(used[v] !=-1)
            return;
        sb.append((char) (v+'a') );
        used[v]=1;
        Iterator<Integer>  it =set[v].iterator();
        while(it.hasNext()){
                dfs(it.next());
        }
    }

    public static void main(String[] args) throws IOException {
        try (Input reader = new StandardInput(); PrintWriter writer = new PrintWriter(System.out)) {
            new ED82C().run();
        }
    }

    StandardInput reader;
    PrintWriter writer;

    @Override
    public void run() {
        try {
            reader = new StandardInput();
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    interface Input extends Closeable {
        String next() throws IOException;

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

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

        default double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        default int[] readIntArray() throws IOException {
            return readIntArray(nextInt());
        }

        default int[] readIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        default long[] readLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < array.length; i++) {
                array[i] = nextLong();
            }
            return array;
        }
    }

    private static class StandardInput implements Input {
        private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        private StringTokenizer stringTokenizer;

        @Override
        public void close() throws IOException {
            reader.close();
        }

        @Override
        public String next() throws IOException {
            if (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
                stringTokenizer = new StringTokenizer(reader.readLine());
            }
            return stringTokenizer.nextToken();
        }
    }
}