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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;

public class Main {

    static int T;
    static String s;
    static ArrayList<HashSet<Integer>> adj;
    static char ans[];
    static boolean fail;
    static boolean isVisited[];
    static int length;
    static String str;

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        T = Integer.parseInt(br.readLine());

        while (T-- > 0) {
            adj = new ArrayList<>();
            ans = new char[26];
            length = 0;
            str = "";

            s = br.readLine();
            if (s.length() == 1) {
                print(s);
                continue;
            }
            fail = true;

            for (int i = 0; i <= 26; i++) {
                adj.add(new HashSet<>());
            }

            for (int i = 0; i < s.length() - 1; i++) {
                int a = s.charAt(i) - 'a';
                int b = s.charAt(i + 1) - 'a';
                adj.get(a).add(b);
                adj.get(b).add(a);
            }
            isVisited = new boolean[26];
            for (int i = 0; i < 26; i++) {
                if (adj.get(i).size() == 1) {
                    dfs(i, (char) ('a' + i) + "");
                }

                if (str.length() != 0) {
                    print(str);
                    fail = false;
                    break;
                }
            }
            if (fail) {
                System.out.println("NO");
            }
        }

    }

    private static void print(String str) {
        System.out.println("YES");
        System.out.print(str);
        for (int j = 0; j < 26; j++) {
            char c = (char) ('a' + j);
            if (str.contains(c + "")) {
                continue;
            }
            System.out.print(c);
        }
        System.out.println();
    }

    public static void dfs(int n, String path) {

        if (isVisited[n]) {
            return;
        }
        if (adj.get(n).size() >= 3) {
            str="";
            return;
        }
        if (length < path.length()) {
            length = path.length();
            str = path;
        }

        isVisited[n] = true;

        for (int next : adj.get(n)) {
            dfs(next, path + (char) (next + 'a'));
        }
    }
}