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;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
void yesNo(long long n, long long x = 0) {
  if (x == 0)
    cout << (n ? "YES\n" : "NO\n");
  else {
    cout << (n ? "Yes\n" : "No\n");
  }
}
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v);
template <typename A>
ostream &operator<<(ostream &cout, set<A> const &s);
template <typename A, typename B>
ostream &operator<<(ostream &cout, map<A, B> const &m);
template <typename A>
ostream &operator<<(ostream &cout, multiset<A> const &s);
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v) {
  cout << "[";
  for (long long i = 0; i < v.size(); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
template <typename A>
ostream &operator<<(ostream &cout, set<A> const &s) {
  cout << "[";
  int i = 0;
  for (auto val : s) {
    if (i) cout << ", ";
    cout << val;
    i++;
  }
  return cout << "]";
}
template <typename A>
ostream &operator<<(ostream &cout, multiset<A> const &s) {
  cout << "[";
  int i = 0;
  for (auto val : s) {
    if (i) cout << ", ";
    cout << val;
    i++;
  }
  return cout << "]";
}
template <typename A, typename B>
ostream &operator<<(ostream &cout, map<A, B> const &m) {
  cout << "[";
  int i = 0;
  for (auto val : m) {
    if (i) cout << ", ";
    cout << val;
    i++;
  }
  return cout << "]";
}
template <typename A, typename B>
istream &operator>>(istream &cin, pair<A, B> &p) {
  cin >> p.first;
  return cin >> p.second;
}
const long long mod = 1e9 + 7;
const long long N = 1e5;
const long long MAX = LLONG_MAX;
const long long modulo = 998244353;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
long long f, n, m, k, q, l, r, x, y, z, ans, cnt;
void solve(int te) {
  f = ans = 0;
  cnt = 0;
  x = y = z = 0;
  string s;
  cin >> s;
  n = (long long)((s).size());
  std::vector<set<char>> v(26);
  for (long long i = 0; i < n; i++) {
    if (i + 1 < n) v[s[i] - 'a'].insert(s[i + 1]);
    if (i - 1 >= 0) v[s[i] - 'a'].insert(s[i - 1]);
  }
  string x;
  int i = s[0] - 'a';
  x += s[0];
  while (1) {
    if ((long long)((v[i]).size())) {
      if ((long long)((v[i]).size()) > 2) {
        yesNo(0);
        return;
      }
      auto it = v[i].begin();
      x += *it;
      y = i;
      i = *it - 'a';
      v[y].erase(it);
      v[i].erase(char('a' + y));
    } else {
      break;
    }
  }
  reverse((x).begin(), (x).end());
  i = x.back() - 'a';
  while (1) {
    if ((long long)((v[i]).size())) {
      if ((long long)((v[i]).size()) > 2) {
        yesNo(0);
        return;
      }
      auto it = v[i].begin();
      x += *it;
      y = i;
      i = *it - 'a';
      v[y].erase(it);
      v[i].erase(char('a' + y));
    } else {
      break;
    }
  }
  std::vector<long long> st(26);
  for (long long i = 0; i < (long long)((x).size()); i++) {
    if (st[x[i] - 'a']) {
      yesNo(0);
      return;
    }
    st[x[i] - 'a']++;
  }
  for (long long i = 0; i < 26; i++) {
    if (!st[i] and (long long)((v[i]).size())) {
      yesNo(0);
      return;
    }
  }
  yesNo(1);
  cout << x;
  for (long long i = 0; i < 26; i++) {
    if (!st[i]) {
      cout << char('a' + i);
    }
  }
  cout << "\n";
}
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(NULL);
  ;
  int t = 1;
  std::cin >> t;
  for (int test = 1; test <= t; test++) {
    solve(test);
  }
  return 0;
}