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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long p = 998244353;
long long int fac[200005];
long long int power(long long int x, long long int y, long long int m) {
  if (y == 0) return 1;
  long long int p = power(x, y / 2, m) % m;
  p = (p * p) % m;
  return (y % 2 == 0) ? p : (x * p) % m;
}
long long int mod(long long int x) {
  if (x < 0)
    return -x;
  else
    return x;
}
long long int inverse(long long int a, long long int p) {
  return power(a, p - 2, p);
}
long long int ncr(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;
}
vector<long long int> visited;
vector<vector<long long int> > adj;
void dfs(long long int s, long long int check) {
  if (visited[s] == 1) return;
  if (check) cout << char(s + 'a');
  visited[s] = 1;
  for (long long int i = (0); i <= ((long long int)(adj[s].size()) - 1); i++) {
    if (!visited[adj[s][i]]) {
      dfs(adj[s][i], check);
    }
  }
}
signed main() {
  long long int t;
  cin >> t;
  ;
  while (t--) {
    long long int m = 26;
    string s;
    cin >> s;
    visited.resize(m);
    adj.resize(m);
    for (long long int i = (0); i <= (25); i++) visited[i] = 0;
    long long int n = s.size();
    if (n == 1) {
      cout << "YES" << '\n';
      for (long long int j = (0); j <= (25); j++) cout << char(j + 'a');
      cout << '\n';
    } else {
      for (long long int i = (0); i <= (n - 2); i++) {
        long long int check = 1;
        for (long long int j = (0);
             j <= ((long long int)(adj[s[i] - 'a'].size()) - 1); j++) {
          if (adj[s[i] - 'a'][j] == s[i + 1] - 'a') check = 0;
        }
        if (check) {
          adj[s[i] - 'a'].push_back(s[i + 1] - 'a');
          adj[s[i + 1] - 'a'].push_back(s[i] - 'a');
        }
      }
      long long int present[26] = {0};
      long long int check = 1;
      for (long long int i = (0); i <= (n - 1); i++) {
        if ((long long int)(adj[s[i] - 'a'].size()) > 2) check = 0;
        present[s[i] - 'a'] = 1;
      }
      if (!check)
        cout << "NO" << '\n';
      else {
        vector<long long int> leaves;
        for (long long int i = (0); i <= (n - 1); i++) {
          if ((long long int)(adj[s[i] - 'a'].size()) == 1) {
            long long int flag = 1;
            for (long long int j = (0);
                 j <= ((long long int)(leaves.size()) - 1); j++) {
              if (leaves[j] == s[i] - 'a') flag = 0;
            }
            if (flag) leaves.push_back(s[i] - 'a');
          }
        }
        long long int zero = 0;
        for (long long int i = (0); i <= ((long long int)(leaves.size()) - 1);
             i++) {
          if (!visited[leaves[i]]) dfs(leaves[i], zero);
        }
        long long int check = 1;
        for (long long int i = (0); i <= (25); i++) {
          if (present[i] && !visited[i]) check = 0;
        }
        if (!check)
          cout << "NO" << '\n';
        else {
          cout << "YES" << '\n';
          for (long long int i = (0); i <= (25); i++) visited[i] = 0;
          long long int one = 1;
          for (long long int i = (0); i <= ((long long int)(leaves.size()) - 1);
               i++) {
            if (!visited[leaves[i]]) dfs(leaves[i], one);
          }
          for (long long int i = (0); i <= (25); i++)
            if (!visited[i]) cout << char(i + 'a');
          cout << '\n';
        }
        leaves.clear();
      }
    }
    visited.clear();
    adj.clear();
  }
}