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.*;
 
public class Class
{
    static class Solve
    {
        MyReader mr = new MyReader();
        Map<Character,Set<Character>> g;
        Set<Character> used;
        public void solve() {
            int t = mr.nextInt();
            out:
            while (t-- > 0){
                String s = mr.next();
                g = new HashMap<>();
 
                StringBuilder res = new StringBuilder();
                int n = s.length();
                if(n == 1){
                    res.append(s);
                    for(char c ='a';c<='z';c++){
                        if(c == s.charAt(0))continue;
                        res.append(c);
                    }
 
                    System.out.println("YES");
                    System.out.println(res.toString());
                    continue;
                }
                for(int i = 0;i<n-1;i++){
                    char u = s.charAt(i);
                    char v = s.charAt(i+1);
 
                    if(g.containsKey(u)){
                        g.get(u).add(v);
                    }
                    else{
                        Set<Character> tmp = new HashSet<>();
                        tmp.add(v);
                        g.put(u,tmp);
                    }
 
                    if(g.containsKey(v)){
                        g.get(v).add(u);
                    }
                    else{
                        Set<Character> tmp = new HashSet<>();
                        tmp.add(u);
                        g.put(v,tmp);
                    }
 
                    if(g.get(u).size() > 2 || g.get(v).size() > 2){
                        System.out.println("NO");
                        continue out;
                    }
                }
 
                used = new HashSet<>();
 
 
 
                boolean found = false;
                for(char c = 'a';c <= 'z';c++){
                    if(!g.containsKey(c) || g.get(c).size() > 1)continue;
 
 
                    found = true;
                    dfs(c,res,'.');
                    break;
                }
 
                if(!found){
                    System.out.println("NO");
                    continue;
                }
 
                for(char c = 'a';c<='z';c++){
                    if(used.contains(c))continue;
                    res.append(c);
                }
 
                System.out.println("YES");
                System.out.println(res.toString());
            }
        }
 
        private void dfs(char c, StringBuilder res, char parent) {
            res.append(c);
            used.add(c);
 
            for(char cc : g.get(c))if(cc!=parent){
                dfs(cc,res,c);
            }
        }
    }
 
    public static void main(String[] args) {
        new Solve().solve();
    }
 
    static class MyReader {
        BufferedReader br;
        StringTokenizer st;
 
        MyReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception 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 res = "";
            try {
                res = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
 
            return res;
        }
 
        Integer[] nextIntArray(int n) {
            Integer[] arr = new Integer[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
 
            return arr;
        }
 
        Long[] nextLongArray(int n) {
            Long[] arr = new Long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
 
            return arr;
        }
 
        String[] nextStringArray(int n) {
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = next();
            }
            return arr;
        }
    }
 
    static void swap(int[] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
 
}