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;
template <typename T>
inline T GCD(T a, T b) {
  a = abs(a);
  b = abs(b);
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
template <typename T>
inline T LCM(T x, T y) {
  T tp = GCD(x, y);
  if ((x / tp) * 1. * y > 9e18) return 9e18;
  return (x / tp) * y;
}
template <typename T>
inline T BigMod(T A, T B, T M) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % M;
    A = (A * A) % M;
    B = B >> 1;
  }
  return ret;
}
template <typename T>
inline T InvMod(T A, T M) {
  return BigMod(A, M - 2, M);
}
long long gcdr(long long a, long long b) {
  if (a == 0) return b;
  return gcdr(b % a, a);
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
void FastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
}
const long long size3 = 300005;
const long long size2 = 200005;
const long long size1 = 100005;
set<long long> G[200];
long long visited[200] = {0};
string ss = "";
long long imp = 0;
void dfs(long long curr, long long last) {
  visited[curr] = 1;
  ss += (char)(curr + 'a');
  for (auto it = G[curr].begin(); it != G[curr].end(); ++it) {
    if (visited[*it] == 1 && *it != last) {
      imp = 1;
      return;
    } else if (visited[*it] == 0)
      dfs(*it, curr);
  }
  return;
}
int main() {
  FastIO();
  long long t, i, j, m, x, y, n;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    imp = 0;
    memset(visited, 0, sizeof(visited));
    n = s.size();
    for (i = 0; i < 199; i++) {
      G[i].clear();
    }
    for (i = 1; i < n; i++) {
      if (s[i] == s[i - 1]) {
        continue;
      }
      G[s[i] - 'a'].insert(s[i - 1] - 'a');
      G[s[i - 1] - 'a'].insert(s[i] - 'a');
    }
    vector<string> ans;
    for (i = 0; i < 26; i++) {
      if (G[i].size() > 2) {
        imp = 1;
      }
      if (visited[i] == 0 && G[i].size() == 1) {
        ss = "";
        dfs(i, i);
        ans.push_back(ss);
      } else if (visited[i] == 0 && G[i].size() == 0) {
        ss = "";
        ss += (char)(i + 'a');
        ans.push_back(ss);
      }
    }
    string res = "";
    for (i = 0; i < ans.size(); i++) {
      res += ans[i];
    }
    if (imp || res.size() < 26) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
      cout << res << endl;
    }
  }
  return 0;
}