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.math.*;
import java.util.*;
import java.io.*;

public class CFA {
  BufferedReader br;
  PrintWriter out;
  StringTokenizer st;
  boolean eof;
  private static final long MOD = 1000L * 1000L * 1000L + 7;
  private static final int[] dx = {0, -1, 0, 1};
  private static final int[] dy = {1, 0, -1, 0};
  private static final String yes = "Yes";
  private static final String no = "No";

  void solve() {
    int T = nextInt();
//    int T = 1;
    for (int i = 0; i < T; i++) {
      helper();
    }
  }

  boolean[][] graph;
  boolean[] vis;
  int LIMIT = 26;
  void helper() {
    char[] arr = nextString().toCharArray();
    int n = arr.length;
    if (n == 1) {
      outln(yes.toUpperCase());
      for (int i = 0; i < LIMIT; i++) {
        out((char) ('a' + i));
      }
      outln("");
      return;
    }
    graph = new boolean[LIMIT][LIMIT];
    for (int i = 0; i < n - 1; i++) {
      int i1 = arr[i] - 'a';
      int i2 = arr[i + 1] - 'a';
      int m1 = Math.min(i1, i2);
      int m2 = Math.max(i1, i2);
      graph[m1][m2] = true;
      graph[m2][m1] = true;
    }

    int[] degree = new int[LIMIT];
    for (int i = 0; i < LIMIT; i++) {
      for (int j = i + 1; j < LIMIT; j++) {
        if (graph[i][j]) {
          degree[i]++;
          degree[j]++;
        }
      }
    }
    List<Integer> one = new ArrayList<>();
    int maxDegree = -1;
    for (int i = 0; i < LIMIT; i++) {
      if (degree[i] == 1) {
        one.add(i);
      }
      maxDegree = Math.max(maxDegree, degree[i]);
    }
    if (one.size() != 2 || maxDegree > 2) {
      outln(no.toUpperCase());
      return;
    }
    vis = new boolean[LIMIT];
    int first = one.get(0);
    List<Integer> res = new ArrayList<>();
    dfs(-1, first, res);
    for (int i = 0; i < LIMIT; i++) {
      if (degree[i] == 0) {
        res.add(i);
      }
    }
    outln(yes.toUpperCase());
    for (int v : res) {
      out((char) (v + 'a'));
    }
    outln("");
  }

  void dfs(int par, int cur, List<Integer> res) {
    if (vis[cur]) {
      return;
    }
    res.add(cur);
    vis[cur] = true;
    for (int i = 0; i < LIMIT; i++) {
      if (graph[cur][i]) {
        if (i == par) {
          continue;
        }
        dfs(cur, i, res);
      }
    }
  }

  void shuffle(int[] a) {
    int n = a.length;
    for(int i = 0; i < n; i++) {
      int r = i + (int) (Math.random() * (n - i));
      int tmp = a[i];
      a[i] = a[r];
      a[r] = tmp;
    }
  }

  long gcd(long a, long b) {
    while(a != 0 && b != 0) {
      long c = b;
      b = a % b;
      a = c;
    }
    return a + b;
  }
  int gcd(int a, int b) {
    while(a != 0 && b != 0) {
      int c = b;
      b = a % b;
      a = c;
    }
    return a + b;
  }
  private void outln(Object o) {
    out.println(o);
  }
  private void out(Object o) {
    out.print(o);
  }
  private void formatPrint(double val) {
    outln(String.format("%.9f", val));
  }
  public CFA() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);
    solve();
    out.close();
  }
  public static void main(String[] args) {
    new CFA();
  }

  public long[] nextLongArr(int n) {
    long[] res = new long[n];
    for(int i = 0; i < n; i++)
      res[i] = nextLong();
    return res;
  }
  public int[] nextIntArr(int n) {
    int[] res = new int[n];
    for(int i = 0; i < n; i++)
      res[i] = nextInt();
    return res;
  }
  public String nextToken() {
    while (st == null || !st.hasMoreTokens()) {
      try {
        st = new StringTokenizer(br.readLine());
      } catch (Exception e) {
        eof = true;
        return null;
      }
    }
    return st.nextToken();
  }
  public String nextString() {
    try {
      return br.readLine();
    } catch (IOException e) {
      eof = true;
      return null;
    }
  }
  public int nextInt() {
    return Integer.parseInt(nextToken());
  }
  public long nextLong() {
    return Long.parseLong(nextToken());
  }
  public double nextDouble() {
    return Double.parseDouble(nextToken());
  }
}