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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void solve() {
  string s;
  cin >> s;
  long long n = s.size();
  if (n == 1) {
    cout << "YES"
         << "\n";
    for (char c = 'a'; c <= 'z'; c++) cout << c;
    cout << "\n";
    return;
  }
  vector<set<char>> v(26);
  for (long long i = 0; i < n; i++) {
    if (i > 0) v[s[i] - 'a'].insert(s[i - 1]);
    if (i < n - 1) v[s[i] - 'a'].insert(s[i + 1]);
  }
  long long flag = 0, cnt = 0;
  char c;
  for (long long i = 0; i < 26; i++) {
    if (v[i].size() > 2) {
      flag = 1;
      break;
    }
    if (v[i].size() == 1) {
      c = i + 'a';
      cnt++;
    }
  }
  if (flag || cnt == 0) {
    cout << "NO"
         << "\n";
    return;
  }
  vector<long long> vis(26, 0);
  string ans;
  ans.push_back(c);
  vis[c - 'a'] = 1;
  set<char> stt{((s).begin()), ((s).end())};
  while (1) {
    set<char> st = v[c - 'a'];
    long long f = 0;
    for (char x : st) {
      if (!vis[x - 'a']) {
        ans.push_back(x);
        vis[x - 'a'] = 1;
        c = x;
        f = 1;
      }
    }
    if (!f) break;
  }
  if (ans.size() != stt.size()) {
    cout << "NO"
         << "\n";
    return;
  }
  for (char cc = 'a'; cc <= 'z'; cc++) {
    if (!vis[cc - 'a']) ans.push_back(cc);
  }
  cout << "YES"
       << "\n";
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}