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;
long long GCD(long long x, long long y) {
  if (y == 0) return x;
  return GCD(y, x % y);
}
long long LCM(long long x, long long y) { return (x * y) / GCD(x, y); }
long long MPOW(long long a, long long b, long long m = LLONG_MAX) {
  if (b == 0) return 1;
  long long x = MPOW(a, b / 2, m);
  x = (x * x) % m;
  if (b % 2 == 1) x = (x * a) % m;
  return x;
}
long long MINV(long long a, long long m) { return MPOW(a, m - 2, m); }
inline long long max3(long long a, long long b, long long c) {
  return max(a, max(b, c));
}
inline long long min3(long long a, long long b, long long c) {
  return min(a, min(b, c));
}
inline bool sortbythis(pair<long long, long long> a,
                       pair<long long, long long> b) {
  return (((a.first == b.first) && (a.second < b.second)) ||
          (a.first < b.first));
}
inline bool sortbythat(pair<long long, long long> a,
                       pair<long long, long long> b) {
  return (((a.second == b.second) && (a.first < b.first)) ||
          (a.second < b.second));
}
class pnc {
  long long FACT_MAX, MODU;
  vector<long long> fact;

 public:
  pnc(long long n, long long m) {
    FACT_MAX = n;
    fact.resize(FACT_MAX);
    MODU = m;
    MFACT_INIT(MODU);
  }
  void MFACT_INIT(long long m) {
    fact[0] = 1;
    for (long long i = 1; i < FACT_MAX; ++i) fact[i] = (i * fact[i - 1]) % MODU;
  }
  long long MFACT(long long n) { return fact[n]; }
  long long PERM(long long n, long long r) {
    return (fact[n] * ::MINV(fact[n - r], MODU)) % MODU;
  }
  long long COMB(long long n, long long r) {
    return (PERM(n, r) * ::MINV(fact[r], MODU)) % MODU;
  }
};
void dfs(vector<vector<long long> > &graph, long long pos, vector<bool> &visit,
         string &thestring) {
  visit[pos] = true;
  thestring.push_back('a' + pos);
  for (auto x : graph[pos])
    if (!visit[x]) dfs(graph, x, visit, thestring);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long TEST = 1;
  cin >> TEST;
  while (TEST--) {
    string s;
    cin >> s;
    if (s.size() == 1) {
      cout << "YES\n";
      cout << s[0];
      for (long long i = 0; i < 26; ++i)
        if ('a' + i != s[0]) cout << (char)(i + 'a');
      cout << '\n';
      continue;
    }
    vector<vector<long long> > graph(26);
    for (long long i = 0; i < s.size() - 1; ++i) {
      bool shouldi = true;
      for (auto x : graph[s[i] - 'a'])
        shouldi &= (x != (long long)(s[i + 1] - 'a'));
      if (shouldi) {
        graph[s[i] - 'a'].push_back(s[i + 1] - 'a');
        graph[s[i + 1] - 'a'].push_back(s[i] - 'a');
      }
    }
    bool ans = true;
    for (long long i = 0; i < 26; ++i) {
      if (graph[i].size() > 2) {
        ans = false;
        break;
      }
    }
    string thestring;
    if (ans) {
      vector<bool> visit(26, false);
      bool istwo = false;
      bool isone = false;
      for (long long i = 0; i < 26; ++i) {
        if (!visit[i]) {
          if (graph[i].size() == 0) {
            visit[i] = true;
            thestring.push_back('a' + i);
          } else if (graph[i].size() == 2)
            continue;
          else {
            isone = true;
            if (istwo) {
              ans = false;
              break;
            } else {
              istwo = true;
              dfs(graph, i, visit, thestring);
            }
          }
        }
      }
      ans &= isone;
    }
    if (ans)
      cout << "YES\n" << thestring << '\n';
    else
      cout << "NO\n";
  }
  return 0;
}