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;
void swap(long long &a, long long &b) {
  a = a + b;
  b = a - b;
  a -= b;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<bool> seive(long long n) {
  vector<bool> toret(n, true);
  toret[1] = false;
  for (long long i = 2; i * i <= n; i++) {
    if (toret[i]) {
      for (long long j = i * i; j <= n; j += i) toret[j] = false;
    }
  }
  return toret;
}
long long expo(long long x, long long y, long long mod = -1) {
  long long res = 1;
  if (mod == -1) {
    while (y > 0) {
      if (y & 1) res *= x;
      y /= 2;
      x *= x;
    }
  } else {
    x %= mod;
    while (y > 0) {
      if (y & 1) res = (res * x) % mod;
      y /= 2;
      x = (x * x) % mod;
    }
  }
  return res;
}
long long fact(long long n, long long mod = -1) {
  long long ans = 1;
  if (mod == -1) {
    for (long long i = 1; i < n + 1; i++) ans *= i;
  } else {
    for (long long i = 1; i < n + 1; i++) {
      ans *= i % mod;
      ans %= mod;
    }
  }
  return ans;
}
long long comb(long long n, long long r, long long mod = -1) {
  long long ans = 1;
  if (mod == -1) {
    for (long long i = 0; i < r; i++) {
      ans *= (n - i);
      ans /= (i + 1);
    }
  } else {
    vector<long long> C(r + 1, 1);
    for (long long i = 2; i <= n; i++) {
      for (long long j = min(i - 1, r); j >= 1; j--)
        C[j] = (C[j] + C[j - 1]) % mod;
    }
    ans = C[r];
  }
  return ans;
}
void solve() {
  string s;
  cin >> s;
  vector<long long> adj[26];
  set<pair<char, char>> done;
  if (s.length() == 1) {
    cout << "YES\n";
    cout << "abcdefghijklmnopqrstuvwxyz\n";
    return;
  }
  for (long long i = 1; i < s.length(); i++) {
    char a = min(s[i], s[i - 1]), b = max(s[i], s[i - 1]);
    if (done.find({a, b}) != done.end() || a == b) continue;
    done.insert({a, b});
    adj[s[i] - 'a'].push_back(s[i - 1] - 'a');
    adj[s[i - 1] - 'a'].push_back(s[i] - 'a');
  }
  vector<bool> vis(26, 0);
  string ans;
  bool tr = false;
  long long ind;
  for (long long i = 0; i < 26; i++) {
    if (adj[i].size() == 1) {
      tr = true;
      ind = i;
      break;
    }
  }
  if (!tr) {
    cout << "NO\n";
    return;
  }
  vis[ind] = true;
  stack<long long> df;
  vector<long long> par(26, -1);
  par[ind] = -1;
  df.push(ind);
  while (!df.empty()) {
    long long cur = df.top();
    ans.push_back(cur + 'a');
    df.pop();
    if (adj[cur].size() > 2) {
      cout << "NO\n";
      return;
    }
    for (long long j = 0; j < adj[cur].size(); j++) {
      long long v = adj[cur][j];
      if (!vis[v]) {
        par[v] = cur;
        vis[v] = true;
        df.push(v);
      } else if (v != par[cur]) {
        cout << "NO\n";
        return;
      }
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (!vis[i]) ans.push_back(i + 'a');
  }
  cout << "YES\n";
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}