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;
long long int INF = 1e18;
const long long fact_table = 800008;
double Pi = 3.1415926535897932384626;
priority_queue<long long> pql;
priority_queue<pair<long long, long long> > pqp;
priority_queue<long long, vector<long long>, greater<long long> > pqls;
long long dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
long long dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
long long mod = 998244353;
long long rui(long long number1, long long number2) {
  if (number2 == 0) {
    return 1;
  } else {
    long long number3 = rui(number1, number2 / 2);
    number3 *= number3;
    number3 %= mod;
    if (number2 % 2 == 1) {
      number3 *= number1;
      number3 %= mod;
    }
    return number3;
  }
}
long long gcd(long long number1, long long number2) {
  if (number1 > number2) {
    swap(number1, number2);
  }
  if (number1 == 0 || number1 == number2) {
    return number2;
  } else {
    return gcd(number2 % number1, number1);
  }
}
void YES(bool condition) {
  if (condition) {
    cout << "YES"
         << "\n";
    ;
  } else {
    cout << "NO"
         << "\n";
    ;
  }
  return;
}
void Yes(bool condition) {
  if (condition) {
    cout << "Yes"
         << "\n";
    ;
  } else {
    cout << "No"
         << "\n";
    ;
  }
  return;
}
long long n, m, num, sum, a, b, c, d, e, h, r, l, q;
long long k;
long long x[500005], y[500005], z[500005];
char s[500005];
bool used[50][50];
bool visited[50];
vector<long long> G[505];
void dfs(long long v, long long p) {
  visited[v] = true;
  char print = v + 'a';
  cout << (print);
  ;
  for (long long i = 0; i < G[v].size(); i++) {
    long long nv = G[v][i];
    if (nv == p) continue;
    dfs(nv, v);
  }
  return;
}
void solve() {
  cin >> s;
  n = strlen(s);
  if (n == 1) {
    cout << "YES"
         << "\n";
    ;
    for (long long i = 0; i < 26; i++) {
      char print = i + 'a';
      cout << (print);
      ;
    }
    cout << endl;
    ;
    return;
  }
  for (long long i = 0; i < 40; i++) {
    for (long long j = 0; j < 40; j++) {
      used[i][j] = false;
    }
    G[i].clear();
    visited[i] = false;
  }
  for (long long i = 0; i < n - 1; i++) {
    long long a = s[i] - 'a';
    long long b = s[i + 1] - 'a';
    if (!used[a][b]) {
      G[a].push_back(b);
      G[b].push_back(a);
      used[a][b] = true;
      used[b][a] = true;
    }
  }
  bool dame = false;
  long long cnt = 0;
  for (long long i = 0; i < 26; i++) {
    if (G[i].size() == 1) cnt++;
    if (G[i].size() >= 3) dame = true;
  }
  if (cnt == 0) dame = true;
  YES(!dame);
  if (dame) return;
  if (!dame) {
    while (true) {
      long long next = -1;
      for (long long i = 0; i < 26; i++) {
        if (!visited[i] && G[i].size() <= 1) next = i;
      }
      if (next == -1) break;
      dfs(next, -1);
    }
  }
  cout << endl;
  ;
  return;
}
int main() {
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}