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;
const long long MXN = 2e3 + 10;
const long long MX5 = 2e5 + 10;
const long long MX6 = 1e6 + 10;
const long long LOG = 20;
const long long INF = 8e18;
const double eps = 1e-9;
const long long MOD = 1e9 + 7;
long long power(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * power(a * a % md, b / 2, md) % md
                      : power(a * a % md, b / 2, md) % md));
}
long long bmm(long long a, long long b) {
  return (a % b == 0 ? b : bmm(b, a % b));
}
string base2(long long n) {
  string a = "";
  while (n >= 2) {
    a += (char)(n % 2 + '0');
    n /= 2;
  }
  a += (char)(n + '0');
  reverse((a).begin(), (a).end());
  return a;
}
long long q, n, tt;
set<long long> G[LOG * 3];
set<pair<long long, long long> > st;
string s, str;
bool vis[LOG * 3], f = 0;
void dfs(long long u, long long par) {
  vis[u] = 1;
  str += (char)(u + 'a');
  for (auto v : G[u]) {
    if (v == par) continue;
    if (vis[v])
      f = 1;
    else
      dfs(v, u);
  }
}
void solve() {
  cin >> s;
  n = s.size(), f = 0, tt = 0;
  st.clear();
  for (int i = 0; i <= 30; i++) G[i].clear(), vis[i] = 0;
  for (int i = 0; i < n - 1; i++) {
    long long u = s[i] - 'a', v = s[i + 1] - 'a';
    G[u].insert(v), G[v].insert(u);
    st.insert({min(u, v), max(u, v)});
  }
  for (int i = 'a'; i <= 'z'; i++) {
    if (G[i - 'a'].size() > 2) {
      cout << "NO" << '\n';
      return;
    }
  }
  tt = 0;
  for (int i = 0; i < n; i++) {
    long long u = s[i] - 'a';
    if (!vis[u]) {
      f = 0;
      dfs(u, -1);
      if (f) {
        cout << "NO" << '\n';
        return;
        ;
      }
      tt++;
    }
  }
  if (tt > 1) {
    cout << "NO" << '\n';
    return;
  }
  for (int i = 0; i <= 30; i++) vis[i] = 0;
  cout << "YES" << '\n';
  for (int i = 'a' - 'a'; i <= 'z' - 'a'; i++) {
    if (!vis[i] && G[i].size() <= 1) {
      str = "";
      dfs(i, -1);
      cout << str;
    }
  }
  cout << '\n';
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> q;
  while (q--) solve();
  return 0;
}