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 int S = 100 * 1000 + 5;
const int TS = 2505;
const long long int INF = 2e18 + 5;
const int MOD = 998244353;
const long double EPS = 0.00000001;
const int ENC = 1024 * 8;
const bool LOCAL = false;
const int NONE = -42;
template <typename T>
struct base_point {
  T x, y;
  base_point<T>() {}
  base_point<T>(T x, T y) {
    this->x = x;
    this->y = y;
  }
  void read() { cin >> x >> y; }
  pair<T, T> as_pair() { return make_pair(x, y); }
  base_point<T> operator+(base_point<T> &other) {
    return base_point<T>(x + other.x, y + other.y);
  }
  base_point<T> operator+(base_point<T> &&other) {
    return base_point<T>(x + other.x, y + other.y);
  }
  base_point<T> operator-(base_point<T> &other) {
    return base_point<T>(x - other.x, y - other.y);
  }
  base_point<T> operator-(base_point<T> &&other) {
    return base_point<T>(x - other.x, y - other.y);
  }
  base_point<T> operator*(T scalar) {
    return base_point<T>(x * scalar, y * scalar);
  }
  base_point<T> rotate90() { return base_point<T>(-y, x); }
  base_point<T> rotate(T angle) {
    return base_point<T>(cosl(angle) * x - sinl(angle) * y,
                         cosl(angle) * y + sinl(angle) * x);
  }
  bool in_first_quadrant() { return (x >= 0 && y > 0); }
  T operator*(base_point<T> &other) { return x * other.x + y * other.y; }
  T operator%(base_point<T> &other) { return x * other.y - y * other.x; }
  T operator%(base_point<T> &&other) { return x * other.y - y * other.x; }
  bool operator<(base_point<T> &other) {
    if (x == other.x) return y < other.y;
    return x < other.x;
  }
  bool operator==(base_point<T> &other) {
    return (x == other.x) && (y == other.y);
  }
  bool operator==(base_point<T> &&other) {
    return (x == other.x) && (y == other.y);
  }
  bool operator!=(base_point<T> &other) {
    return (x != other.x) || (y != other.y);
  }
  bool operator!=(base_point<T> &&other) {
    return (x != other.x) || (y != other.y);
  }
  T norm() { return x * x + y * y; }
  T len() { return sqrtl(norm()); }
};
mt19937 mt_rand(time(0));
struct mre {
  int v;
  mre() { v = 0; }
  mre(int nv) { v = nv % MOD; }
  mre(long long int nv) { v = nv % MOD; }
  mre operator+(mre other) {
    int r = (v + other.v) % MOD;
    return mre(r);
  }
  mre operator-(mre other) { return mre(v) + other.neg(); }
  mre operator*(mre other) {
    int r = (v * (long long int)other.v) % MOD;
    return mre(r);
  }
  mre neg() {
    if (v == 0) return mre(0);
    return mre(MOD - v);
  }
  bool operator==(mre &other) { return v == other.v; }
  bool operator==(mre &&other) { return v == other.v; }
  mre bpow(int e) {
    if (e == 0) return mre(1);
    mre sq = mre(v) * mre(v);
    if (e & 1) {
      return sq.bpow(e / 2) * mre(v);
    } else {
      return sq.bpow(e / 2);
    }
  }
  mre inv() { return mre(v).bpow(MOD - 2); }
  bool operator<(const mre &other) { return v < other.v; }
};
void fail() {
  cout << "NO"
       << "\n";
}
void success(string k) {
  for (char c = 'a'; c <= 'z'; c++) {
    if (count(k.begin(), k.end(), c) == 0) {
      k.push_back(c);
    }
  }
  cout << "YES\n";
  cout << k << "\n";
}
void solvet() {
  set<char> used;
  set<pair<char, char>> usedp;
  string s;
  cin >> s;
  if (s.size() <= 1) {
    success("");
    return;
  }
  int n = s.size();
  string k = "";
  k.push_back(s[0]);
  k.push_back(s[1]);
  used.insert(s[0]);
  used.insert(s[1]);
  usedp.insert({s[0], s[1]});
  usedp.insert({s[1], s[0]});
  for (int i = 1; i + 1 < n; i++) {
    if (used.count(s[i + 1])) {
      if (usedp.count({s[i], s[i + 1]}) == 0) {
        fail();
        return;
      }
      continue;
    }
    if (s[i] != k[0] && s[i] != *k.rbegin()) {
      fail();
      return;
    }
    if (s[i] == k[0]) {
      string kz = "";
      kz.push_back(s[i + 1]);
      k = kz + k;
    } else {
      k.push_back(s[i + 1]);
    }
    used.insert(s[i + 1]);
    usedp.insert({s[i + 1], s[i + 0]});
    usedp.insert({s[i + 0], s[i + 1]});
  }
  success(k);
}
void solve() {
  int tq = 1;
  cin >> tq;
  for (int tqc = 0; tqc < (tq); tqc++) solvet();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(4);
  solve();
}