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;
using ll = long long;
ll md = 1000000007;
ll exp(ll a, ll b) {
  ll r = 1ll;
  while (b > 0) {
    if (b & 1) {
      r = r * (a % md);
      r = (r + md) % md;
    }
    b >>= 1;
    a = (a % md) * (a % md);
    a = (a + md) % md;
  }
  return (r + md) % md;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll Min(ll a, ll b) {
  if (a < b) return a;
  return b;
}
ll Max(ll a, ll b) {
  if (a > b) return a;
  return b;
}
set<long long> st[26];
bool check;
void dfs(long long x, long long p, vector<ll>& pos) {
  pos[x] = p;
  for (auto& z : st[x]) {
    if (pos[z] != -1) {
      if (abs(pos[z] - pos[x]) != 1) {
        check = false;
        return;
      }
    } else
      dfs(z, p + 1, pos);
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.size();
    for (ll i = 0; i <= 25; ++i) st[i].clear();
    bool foo = true;
    for (ll i = 0; i <= n - 2; ++i) {
      long long x = s[i] - 'a', y = s[i + 1] - 'a';
      if (x == y) {
        foo = false;
        break;
      }
      st[x].insert(y);
      st[y].insert(x);
    }
    for (ll i = 0; i <= 25; ++i)
      if (st[i].size() > 2) {
        foo = false;
        break;
      }
    if (!foo) {
      cout << "NO" << '\n';
      continue;
    }
    vector<ll> pos(26, -1);
    long long cnt = 0;
    for (ll i = 0; i <= 25; ++i)
      if (pos[i] == -1 && st[i].size() < 2) {
        ++cnt;
        check = true;
        dfs(i, cnt * (1e6), pos);
        if (!check) break;
      }
    if (!check) {
      cout << "NO" << '\n';
      continue;
    }
    set<long long> uni;
    for (ll i = 0; i <= 25; ++i) uni.insert(pos[i]);
    if (uni.size() < 26) {
      cout << "NO" << '\n';
      continue;
    }
    vector<ll> perm(26);
    for (ll i = 0; i <= 25; ++i) perm[i] = i;
    sort(perm.begin(), perm.end(),
         [&](long long a, long long b) { return pos[a] < pos[b]; });
    cout << "YES" << '\n';
    string ans;
    for (ll i = 0; i <= 25; ++i) ans += (perm[i] + 'a');
    cout << ans;
    cout << '\n';
  }
  return 0;
}