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>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
long long ModExp(long long x, long long y, long long m) {
  long long res = 1;
  x = x % m;
  while (y > 0) {
    if (y & 1) res = (res * x) % m;
    y = y >> 1;
    x = (x * x) % m;
  }
  return res;
}
string ans = "";
unordered_map<char, unordered_map<char, bool> > adj;
void solve() {
  ans = "";
  string s;
  cin >> s;
  for (long long i = 'a'; i < 'z' + 1; i++) {
    for (long long j = 'a'; j < 'z' + 1; j++) {
      adj[i][j] = false;
    }
  }
  long long n = s.length();
  for (long long i = 0; i < n - 1; i++) {
    adj[s[i]][s[i + 1]] = true;
    adj[s[i + 1]][s[i]] = true;
  }
  if (n == 1) {
    cout << "YES" << endl;
    for (long long i = 'a'; i < 'z' + 1; i++) {
      cout << char(i);
    }
    cout << endl;
    return;
  }
  vector<char> vec;
  for (long long i = 'a'; i < 'z' + 1; i++) {
    long long cu = 0;
    for (long long j = 'a'; j < 'z' + 1; j++) {
      if (adj[i][j]) {
        cu++;
      }
    }
    if (cu == 1) {
      vec.push_back(i);
    }
    if (cu >= 3) {
      cout << "NO" << endl;
      return;
    }
  }
  bool vis['z' + 1] = {};
  for (long long i = 0; i < vec.size(); i++) {
    char c;
    ans += vec[i];
    for (long long j = 'a'; j < 'z' + 1; j++) {
      if (adj[vec[i]][j]) {
        c = j;
        break;
      }
    }
    vis[vec[i]] = true;
    char p = vec[i];
    while (1) {
      if (vis[c] == true) {
        cout << "NO" << endl;
        return;
      }
      ans += c;
      vis[c] = true;
      char n = p;
      for (long long j = 'a'; j < 'z' + 1; j++) {
        if (adj[c][j] == true && (p != j)) {
          n = j;
        }
      }
      if (n == p) {
        break;
      }
      p = c;
      c = n;
    }
    break;
  }
  for (long long i = 0; i < n; i++) {
    if (!vis[s[i]]) {
      cout << "NO" << endl;
      return;
    }
  }
  for (long long i = 'a'; i < 'z' + 1; i++) {
    if (!vis[i]) {
      ans += i;
    }
  }
  cout << "YES" << endl;
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}