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 long double pi = acos(-1.0);
long long powm(long long a, long long b, long long m) {
  if (b == 0) return 1;
  long long t = powm(a, b / 2, m);
  if (b % 2) return a * t % m * t % m;
  return t * t % m;
}
long long modinv1(long long b, long long m) { return powm(b, m - 2, m); }
bool comp(const pair<long long, long long> &p1,
          const pair<long long, long long> &p2) {
  if (abs(p1.first) == abs(p2.first)) return (abs(p1.second) < abs(p2.second));
  return (abs(p1.first) < abs(p2.first));
}
long long modinv(long long n, long long m) {
  long long i = 0;
  for (i = 1; i < m; ++i)
    if ((n * i) % m == 1) return i;
}
char grid1[8][8], grid[8][8];
long long ans = 0;
bool check(long long i, long long j) {
  long long ct1, ct2;
  for (ct1 = 0; ct1 < 8; ++ct1)
    for (ct2 = 0; ct2 < 8; ++ct2) {
      if (ct1 == i && ct2 == j) continue;
      if (grid[ct1][ct2] == '#') {
        if (ct1 == i || ct2 == j || i - j == ct1 - ct2 || i + j == ct1 + ct2)
          return false;
      }
    }
  return true;
}
bool place_queens(long long ct) {
  if (ct == 8) {
    return true;
  }
  long long ct1, ct2;
  for (ct2 = 0; ct2 < 8; ++ct2) {
    if (grid[ct][ct2] == '*') continue;
    grid[ct][ct2] = '#';
    if (check(ct, ct2)) {
      if (place_queens(ct + 1)) ans++;
    }
    grid[ct][ct2] = '.';
  }
  return false;
}
vector<char> adj[26];
bool vis[26];
vector<char> df;
bool checkcycle(char v, char parent) {
  vis[v - 'a'] = 1;
  long long i;
  for (i = 0; i < adj[v - 'a'].size(); ++i) {
    if (!vis[adj[v - 'a'][i] - 'a']) {
      if (checkcycle(adj[v - 'a'][i], v)) return true;
    } else if (adj[v - 'a'][i] != parent)
      return true;
  }
  return false;
}
bool vis1[26];
void dfs(char c) {
  vis1[c - 'a'] = 1;
  df.push_back(c);
  long long i;
  for (i = 0; i < adj[c - 'a'].size(); ++i) {
    if (!vis1[adj[c - 'a'][i] - 'a']) dfs(adj[c - 'a'][i]);
  }
}
void DJ() {
  df.clear();
  long long i;
  for (i = 0; i < 26; ++i) vis[i] = vis1[i] = 0;
  for (i = 0; i < 26; ++i) adj[i].clear();
  string s;
  cin >> s;
  if (s.size() == 1) {
    cout << "YES\n"
         << "abcdefghijklmnopqrstuvwxyz\n";
    return;
  }
  long long f = 0;
  for (i = 0; i < s.size() - 1; ++i) {
    if (find(adj[s[i] - 'a'].begin(), adj[s[i] - 'a'].end(), s[i + 1]) !=
        adj[s[i] - 'a'].end())
      continue;
    adj[s[i] - 'a'].push_back(s[i + 1]);
    adj[s[i + 1] - 'a'].push_back(s[i]);
  }
  long long k = -1;
  for (i = 0; i < 26; ++i) {
    if (adj[i].size() > 2) {
      cout << "NO\n";
      return;
    }
    if (adj[i].size() == 1) k = i;
  }
  if (k == -1) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  dfs('a' + k);
  long long ck[26] = {0};
  for (i = 0; i < df.size(); ++i) ck[df[i] - 'a']++;
  for (i = 0; i < 26; ++i) {
    if (!ck[i]) df.push_back('a' + i);
  }
  for (i = 0; i < df.size(); ++i) cout << df[i];
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1, i;
  cin >> t;
  while (t--) DJ();
  return 0;
}