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 pow1(long long int n, long long int p) {
  if (p == 0) return 1;
  long long int x = pow1(n, p / 2);
  x = (x * x) % 1000000007;
  if (p % 2 == 0)
    return x;
  else
    return (x * n) % 1000000007;
}
string ans = "";
long long int flg = 0;
void dfs(long long int e, vector<set<long long int>> &v, long long int par,
         string &s, vector<long long int> &vis) {
  s += (char)(e + 97);
  vis[e] = 1;
  ans = s;
  long long int c = 0;
  long long int c1 = 0;
  for (auto i : v[e]) {
    if (vis[i] == 1) c1++;
  }
  if (c1 >= 2) {
    flg = 1;
    return;
  }
  for (auto i : v[e]) {
    if (i != par) dfs(i, v, e, s, vis);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  cin >> t;
  for (long long int i = 0; i < t; i++) {
    string s;
    cin >> s;
    long long int n = s.size();
    if (n == 1) {
      cout << "YES"
           << "\n";
      cout << s[0];
      for (long long int i = 0; i < 26; i++) {
        if (i != s[0] - 97) {
          cout << (char)(i + 97);
        }
      }
      cout << "\n";
      continue;
    }
    vector<set<long long int>> v(27);
    for (long long int i = 0; i < (long long int)s.size(); i++) {
      if (i != 0) {
        v[s[i] - 97].insert(s[i - 1] - 97);
      }
      if (i != n - 1) {
        v[s[i] - 97].insert(s[i + 1] - 97);
      }
    }
    long long int e = -1;
    long long int c = 0;
    long long int f = 0;
    for (long long int i = 0; i < 26; i++) {
      if ((long long int)v[i].size() == 1) {
        e = i;
        c++;
      } else if ((long long int)v[i].size() >= 3) {
        f = 1;
        break;
      }
    }
    if (c < 2 || f == 1) {
      cout << "NO"
           << "\n";
      continue;
    }
    string ans = "";
    queue<long long int> q;
    q.push(e);
    vector<long long int> vis(26, 0);
    while (q.size() > 0) {
      long long int x = q.front();
      vis[x]++;
      q.pop();
      ans += (char)(x + 97);
      for (auto i : v[x]) {
        if (vis[i] == 0) q.push(i);
      }
    }
    for (long long int i = 0; i < 26; i++) {
      if (vis[i] == 0) ans += (char)(i + 97);
    }
    cout << "YES"
         << "\n";
    cout << ans << "\n";
  }
  return 0;
}