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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPerfectKeyboard solver = new CPerfectKeyboard();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class CPerfectKeyboard {
        boolean ok;
        boolean[] has;
        boolean[] done;
        TreeSet<Character>[] a;
        ArrayList<Character> ans;

        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] c = s.next().toCharArray();
            int n = c.length;
            if (n == 1) {
                w.println("YES");
                for (int i = 'a'; i <= 'z'; i++) {
                    w.print((char) i);
                }
                w.println();
                return;
            }
            ok = true;
            a = new TreeSet['z' + 1];
            for (int i = 'a'; i <= 'z'; i++) a[i] = new TreeSet<>();
            has = new boolean['z' + 1];
            done = new boolean['z' + 1];
            for (int i = 0; i < c.length; i++) has[c[i]] = true;
            for (int i = 1; i < n; i++) {
                a[c[i]].add(c[i - 1]);
                a[c[i - 1]].add(c[i]);
            }
            ans = new ArrayList<>();
            for (int i = 'a'; i <= 'z'; i++) {
                if (a[i].size() > 2) {
                    w.println("NO");
                    return;
                }
                if (a[i].size() == 1 && !done[i]) {
                    dfs(i, -1);
                    if (!ok) {
                        w.println("NO");
                        return;
                    }
                }
            }
            for (int i = 'a'; i <= 'z'; i++)
                if (has[i] != done[i]) {
                    w.println("NO");
                    return;
                }
            w.println("YES");
            for (char cc : ans) w.print(cc);
            for (int i = 'a'; i <= 'z'; i++) if (!has[i]) w.print((char) i);
            w.println();
        }

        void dfs(int cur, int par) {
            if (done[cur]) {
                ok = false;
                return;
            }
            done[cur] = true;
            ans.add((char) cur);
            for (int i : a[cur])
                if (i != par) dfs(i, cur);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        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();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}