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;
typedef long long ll;
typedef int (*itoi)(int);
typedef int (*iitoi)(int, int);
typedef int (*iiitoi)(int, int, int);
typedef ll (*ltol)(ll);
typedef ll (*lltol)(ll, ll);
typedef ll (*llltol)(ll, ll, ll);
const long double PI = acos(0) * 2;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;
int X4[] = {-1, 0, 1, 0}, Y4[] = {0, -1, 0, 1};
int X8[] = {-1, -1, -1, 0, 1, 1, 1, 0}, Y8[] = {-1, 0, 1, 1, 1, 0, -1, -1};
template <typename T>
inline bool uax(T& a, T b) {
  return a < b ? (a = b, 1) : 0;
}
template <typename T>
inline bool uin(T& a, T b) {
  return a > b ? (a = b, 1) : 0;
}
template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
  return is >> p.first >> p.second;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << '(' << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = 0; i < (int)v.size(); i++) {
    os << v[i];
    if (i + 1 < (int)v.size()) os << ' ';
  }
  return os;
}
bool dfs(int a, vector<vector<int> >& ed, vector<int>& vst, vector<int>& prof) {
  vst[a] = 1;
  prof.push_back(a);
  for (auto& b : ed[a]) {
    if (vst[b]) {
      if (prof.size() > 1 && prof[prof.size() - 2] == b)
        ;
      else {
        return 0;
      }
    } else {
      return dfs(b, ed, vst, prof);
    }
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << std::setprecision(10);
  cout << fixed;
  int q;
  cin >> q;
  while (q--) {
    string s;
    cin >> s;
    int n = s.size();
    s = "_" + s;
    for (int i = 1; i <= (n); i++) s[i] = s[i] - 'a' + 1;
    vector<vector<int> > ed(30, vector<int>());
    for (int i = 1; i <= (n); i++) {
      for (int k = 0; k < (2); k++) {
        int j = i + "02"[k] - '1';
        if (j < 1 || j > n) continue;
        ed[s[i]].push_back(s[j]);
        ed[s[j]].push_back(s[i]);
      }
    }
    for (int i = 1; i <= (26); i++) {
      sort((ed[i]).begin(), (ed[i]).end());
      ed[i].erase(unique((ed[i]).begin(), (ed[i]).end()), (ed[i]).end());
    }
    vector<int> prof;
    vector<int> vst(30, 0);
    bool flag = 1;
    for (int a = 1; a <= (26); a++) {
      if (!vst[a] && (((int)(ed[a]).size()) <= 1))
        flag &= dfs(a, ed, vst, prof);
    }
    if (flag && (int)prof.size() == 26) {
      cout << "YES" << endl;
      for (int a = 0; a < (26); a++) {
        cout << (char)(prof[a] + 'a' - 1);
      }
      cout << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}