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.*;
import java.util.ArrayDeque;
import java.util.Random;
import java.util.StringTokenizer;

public class zero {

    public static void main(String[] args) {
        FastReader scan = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        int t = scan.nextInt();
        for(int tt = 1; tt <= t; tt++) solver.solve(tt, scan, out);
        out.close();
    }

    static class Task {
        static boolean[][] graph;
        static boolean[] visited;
        static int[] degree;
        static ArrayDeque<Integer> order = new ArrayDeque<>();

        public void solve(int testNumber, FastReader scan, PrintWriter out) {
            char[] s = scan.next().toCharArray();
            graph = new boolean[26][26];
            visited = new boolean[26];
            degree = new int[26];
            order = new ArrayDeque<>();
            for(int i = 0; i < s.length-1; i++) {
                int x = s[i]-'a', y = s[i+1]-'a';
                if(graph[x][y]) continue;;
                graph[x][y] = graph[y][x] = true;
                degree[x]++;
                degree[y]++;
                if(degree[x] > 2 || degree[y] > 2) {
                    out.println("NO");
                    return;
                }
            }
            for(int i = 0; i < 26; i++) {
                if(!visited[i] && cycle(-1, i)) {
                    out.println("NO");
                    return;
                }
            }
            visited = new boolean[26];
            for(int i = 0; i < 26; i++) {
                if(!visited[i] && degree[i] <= 1) fillOrder(-1, i);
            }
            out.println("YES");
            for(int i : order) out.print((char) ('a' + i));
            out.println();
        }

        static void fillOrder(int prev, int at) {
            visited[at] = true;
            order.addLast(at);
            for(int i = 0; i < 26; i++) {
                if(graph[at][i] && i != prev) fillOrder(at, i);
            }
        }

        static boolean cycle(int prev, int at) {
            visited[at] = true;
            for(int i = 0; i < 26; i++) {
                if(graph[at][i] && i != prev) {
                    if(visited[i] || cycle(at, i)) return true;
                }
            }
            return false;
        }

    }

    static void shuffle(int[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            int temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static void shuffle(long[] a) {
        Random get = new Random();
        for (int i = 0; i < a.length; i++) {
            int r = get.nextInt(a.length);
            long temp = a[i];
            a[i] = a[r];
            a[r] = temp;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

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

        public FastReader(String s) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(new File(s)));
        }

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

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

}