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;
void __print(int x) { cerr << x; };
void __print(long x) { cerr << x; };
void __print(long long x) { cerr << x; };
void __print(unsigned x) { cerr << x; };
void __print(unsigned long x) { cerr << x; };
void __print(unsigned long long x) { cerr << x; };
void __print(float x) { cerr << x; };
void __print(double x) { cerr << x; };
void __print(long double x) { cerr << x; };
void __print(char x) { cerr << '\'' << x << '\''; };
void __print(const char *x) { cerr << '\"' << x << '\"'; };
void __print(const string &x) { cerr << '\"' << x << '\"'; };
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long fast_pow(long long a, long long b) {
  if (b == 1) return a;
  if (b == 0) return 1;
  long long x = fast_pow(a, b / 2);
  x *= x;
  if (b & 1) x *= a;
  return x;
}
class DisjointSet {
  vector<long long> parent;
  vector<long long> rank;

 public:
  DisjointSet(long long n) {
    parent.resize(n + 1, -1);
    rank.resize(n + 1, 1);
  }
  long long Find(long long x) {
    if (parent[x] == -1) {
      return x;
    }
    return parent[x] = Find(parent[x]);
  }
  void Union(long long x, long long y) {
    long long s1 = Find(x);
    long long s2 = Find(y);
    if (s1 == s2) {
      return;
    }
    if (rank[s1] > rank[s2]) {
      parent[s2] = s1;
      rank[s1] += rank[s2];
    } else {
      parent[s1] = s2;
      rank[s2] += rank[s1];
    }
  }
};
const long long nax = 27;
vector<set<long long>> adj(nax);
vector<long long> visited(nax);
string ans = "";
void dfs(long long root) {
  ans += (char)(root + 'a');
  visited[root] = 1;
  for (auto i : adj[root]) {
    if (!visited[i]) {
      dfs(i);
    }
  }
}
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long tc;
  cin >> tc;
  while (tc--) {
    ans.clear();
    adj.clear();
    adj.resize(27);
    visited.clear();
    visited.resize(27);
    string s;
    cin >> s;
    long long n = (long long)s.size();
    bool checkcycle = 0;
    DisjointSet dSet(27);
    for (long long i = 0; i < n - 1; i++) {
      long long nodea = s[i] - 'a';
      long long nodeb = s[i + 1] - 'a';
      long long prevsz = adj[nodea].size();
      adj[nodea].insert(nodeb);
      adj[nodeb].insert(nodea);
      long long newsz = adj[nodea].size();
      if (dSet.Find(nodea) != dSet.Find(nodeb)) {
        dSet.Union(nodea, nodeb);
      } else if ((newsz != prevsz)) {
        checkcycle = 1;
      }
    }
    for (long long i = 0; i < 26; i++) {
      if (adj[i].size() > 2) {
        checkcycle = 1;
        break;
      }
      if (adj[i].size() == 0) {
        ans += (char)(i + 'a');
      } else if ((adj[i].size() == 1) && !visited[i]) {
        dfs(i);
      }
    }
    if (checkcycle) {
      cout << "NO" << '\n';
      continue;
    }
    cout << "YES" << '\n';
    cout << ans << '\n';
  }
}
int32_t main() {
  solve();
  return 0;
}