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.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.HashSet;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.LinkedHashSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author unknown
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        WPerfectKeyboard solver = new WPerfectKeyboard();
        solver.solve(1, in, out);
        out.close();
    }

    static class WPerfectKeyboard {
        Boolean imposs;
        StringBuilder ans;
        int start;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int ntc = in.nextInt();
            while ((ntc--) > 0) {
                ans = new StringBuilder();
                Integer[] visited = new Integer[26];
                Arrays.fill(visited, 0);
                String s = in.nextString();
                LinkedHashSet<Integer>[] graph = new LinkedHashSet[26];
                imposs = false;
                for (int i = 0; i < 26; i++) {
                    graph[i] = new LinkedHashSet<>();
                }
                for (int i = 0; i < s.length() - 1; i++) {
                    graph[s.charAt(i) - 'a'].add(s.charAt(i + 1) - 'a');
                    graph[s.charAt(i + 1) - 'a'].add(s.charAt(i) - 'a');
                }
                start = s.charAt(0) - 'a';
                for (int i = 0; i < 26; i++) {
                    if (graph[i].size() > 2) {
                        imposs = true;
                    }
                    if (graph[i].size() == 1) {
                        start = i;
                    }
                }
                visited[start] = 1;
                dfs(graph, visited, start, -1);
                if (imposs) {
                    out.println("NO");
                } else {
                    out.println("YES");
                    for (char i = 'a'; i <= 'z'; i++) {
                        if (!ans.toString().contains(Character.toString(i))) {
                            ans.append(i);
                        }
                    }
                    out.println(ans);
                }
            }
        }

        public void dfs(LinkedHashSet<Integer>[] graph, Integer[] visited, Integer to, Integer from) {
            if (!ans.toString().contains(Character.toString(to + 'a'))) {
                ans.append(Character.toString(to + 'a'));
            }
            for (Integer c : graph[to]) {
                if (visited[c] != 0 && !c.equals(from)) {
                    imposs = true;
                    return;
                } else {
                    if (visited[c] == 0) {
                        visited[c] = 1;
                        dfs(graph, visited, c, to);
                    }
//                if(!ans.toString().contains(Character.toString(to+'a')) && start == to){
//                    ans.append(Character.toString(to+'a'));
//                }
                }
            }
//        if(!ans.toString().contains(Character.toString(to+'a'))){
//            ans.append(Character.toString(to+'a'));
//        }
        }

    }

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

        public InputReader(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 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 String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; ++i) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}