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;
long long int modp(long long int a, long long int p, long long int n) {
  int d[100];
  int i, j, k, l;
  if (n == 0) return 1;
  for (i = 0; n >= 1; i++) {
    d[i] = n % 2;
    n /= 2;
  }
  l = i;
  long long int e = 1;
  if (d[0] == 1) e *= (a % p);
  for (i = 1; i < l; i++) {
    a *= a;
    a = a % p;
    if (d[i] == 1) {
      e *= a;
      e = e % p;
    }
  }
  return e % p;
}
long long int modInverse(long long int n, long long int p) {
  return modp(n, p, p - 2);
}
long long int nCrModPFermat(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int fac[n + 1];
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long int maxi(long long int a, long long int b) {
  if (a < b) return b;
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int g, b, ans, t, n, m, i, j, k, l, a[100000], c, d, e, x;
  string s;
  char aa[100];
  cin >> t;
  while (t--) {
    cin >> s;
    l = s.size();
    for (i = 0; i < 100; i++) aa[i] = 0;
    for (i = 0; i < 26; i++) a[i] = 0;
    ans = 1;
    aa[50] = s[0];
    a[s[0] - 'a'] = 1;
    long long int curr_pos = 50;
    for (i = 1; i < l; i++) {
      if (a[s[i] - 'a'] == 0) {
        if (aa[curr_pos + 1] == 0) {
          aa[curr_pos + 1] = s[i];
          curr_pos += 1;
          a[s[i] - 'a'] = 1;
        } else if (aa[curr_pos - 1] == 0) {
          aa[curr_pos - 1] = s[i];
          curr_pos -= 1;
          a[s[i] - 'a'] = 1;
        } else {
          ans = 0;
          break;
        }
      } else {
        if (aa[curr_pos - 1] == s[i]) {
          curr_pos -= 1;
        } else if (aa[curr_pos + 1] == s[i]) {
          curr_pos += 1;
        } else {
          ans = 0;
          break;
        }
      }
    }
    if (ans == 0)
      cout << "NO\n";
    else {
      cout << "YES\n";
      for (i = 0; i < 100; i++) {
        if (aa[i] != 0) cout << aa[i];
      }
      for (i = 0; i < 26; i++) {
        if (a[i] == 0) {
          char cc = 'a' + i;
          cout << cc;
        }
      }
      cout << "\n";
    }
    s.clear();
  }
  return 0;
}