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 java.math.*;
 
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        //Scanner sc = new Scanner();
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();
 
    }
 
    static int INF = (int)1e9;
    static int maxn = 2*(int)1e5+5;
    static int mod= 1000000321 ;
    static int n,m,k,t,q,d,p,g,b;
    
    static ArrayList<Integer> adj[];
    
    void solve(PrintWriter out, Reader in) throws IOException{
        t = in.nextInt();
        
        loop:while (t-->0) {
            String s = in.next();
            n = s.length();
            if (n==1 ){
                out.println("YES");
                for (int i =0; i<26;i++) {
                    out.print((char)(i+'a'));
                }
                out.println();
                continue;
            }
            int deg1 = 0;
            adj = new ArrayList[26];
            for (int i =0; i <26; i++) adj[i] = new ArrayList<Integer>();
            for (int i = 1; i < n; i++) {
                if(!adj[s.charAt(i)-'a'].contains(s.charAt(i-1)-'a')) adj[s.charAt(i)-'a'].add(s.charAt(i-1)-'a');
                if(!adj[s.charAt(i-1)-'a'].contains(s.charAt(i)-'a')) adj[s.charAt(i-1)-'a'].add(s.charAt(i)-'a');
            }
            
            boolean flag = true;
            int start = 0;
            for (int i = 0; i < 26; i++) {
                if (adj[i].size()==1) {
                    deg1++;
                    start = i;
                } else if (adj[i].size()>2) {
                    out.println("NO");
                    continue loop;
                }
            }
            
            if (deg1 != 2 ) {out.println("NO");continue;}
            
            boolean[] vis = new boolean[26];
            vis[start] = true;
            out.println("YES");
            out.print((char)(start+'a'));
            while (true) {
                boolean f = false;
                for (int e:adj[start]) {
                    if (!vis[e]) {
                        start = e;
                        vis[start] = true;
                        out.print((char)(start+'a'));
                        f = true;
                        break;
                    }
                }
                if (!f) break;
            }
            
            for (int i = 0; i<26; i++) {
                if (!vis[i]) {
                    out.print((char)(i+'a'));
                }
            }
            out.println();
        }
    }
    
    //<>
    
    static class Reader {
 
    private InputStream mIs;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
 
    public Reader() {
        this(System.in);
    }
 
    public Reader(InputStream is) {
        mIs = is;
    }
 
    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
 
    }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = mIs.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }
 
    public String nextLine() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndOfLine(c));
        return res.toString();
    }
 
    public String next() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }
 
    double nextDouble()
    {
        return Double.parseDouble(next());
    }
 
    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public int nextInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }
 
    public boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }
 
    public boolean isEndOfLine(int c) {
        return c == '\n' || c == '\r' || c == -1;
    }
 
    }
}