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:
//package org.javatest.codeforce.contest.c82;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class PerfectKeyboard {
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new PerfectKeyboard().run();
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    String getAll(boolean[] all, String res){
        StringBuilder sb = new StringBuilder(res);
        for(int i=0;i<26;i++)
            if(!all[i])
                sb.append((char)('a'+i));
        return sb.toString();
    }

    void solve() throws IOException {
        int tc = readInt();
        while(tc-->0) {
            String str = readString();
            boolean[] all = new boolean[26];
            String res="";
            if(str.length()==1){
                System.out.println("YES");
                System.out.println(getAll(all,res));
                continue;
            }
            res = str.substring(0,2);
            all[str.charAt(0)-'a']=true;
            all[str.charAt(1)-'a']=true;
            boolean notPossible = false;
            for(int i=2;i<str.length();i++){
                char c = str.charAt(i);
                if(!all[c-'a']){
                    //means c is not there, we need to see whether his predecessor is at front or last
                    char p = str.charAt(i-1);
                    int pindex = res.indexOf(p);
                    if(pindex==0){
                        res=c+res;
                        all[c-'a']=true;
                        continue;
                    }
                    if(pindex==res.length()-1){
                        res+=c;
                        all[c-'a']=true;
                        continue;
                    }
                    notPossible=true;
                    break;
                }
                //means c is already there, just check whether its predecessor is its adjacent
                int cindex = res.indexOf(c);
                char p = str.charAt(i-1);
                int pindex = res.indexOf(p);
                if(Math.abs(cindex-pindex)==1){
                    continue;
                }
                notPossible=true;
                break;
            }
            if(notPossible){
                System.out.println("NO");
                continue;
            }
            System.out.println("YES");
            System.out.println(getAll(all,res));
        }
    }
}