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;
double doINF = 1.0 / 0.0;
ostream_iterator<int> outp(cout, " ");
inline long long modadd(long long n, long long m, long long mod) {
  long long sum = ((n + m) % mod + mod) % mod;
  return sum;
}
inline long long modsub(long long n, long long m, long long mod) {
  long long diff = ((n - m + mod) % mod + mod) % mod;
  return diff;
}
inline long long modpro(long long n, long long m, long long mod) {
  long long pro = ((n * m) % mod + mod) % mod;
  return pro;
}
inline long long pow(int x, int y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
inline long long powmod(long long x, long long y, long long mod) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = modpro(res, x, mod);
    y = y >> 1;
    x = modpro(x, x, mod);
  }
  return res;
}
long long min(long long a, long long b) {
  if (a > b) {
    return b;
  }
  return a;
}
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else
    return b;
}
bool pairdec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first)
    return (a.first > b.first);
  else
    return a.second > b.second;
}
long long power(long long x, long long y, long long mod) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long modInverse(long long a, long long mod) {
  return powmod(a, mod - 2, mod);
}
long long modFact(long long n, long long mod) {
  if (n >= mod) return 0;
  long long result = 1;
  for (long long i = 1; i <= n; i++) result = (result * i) % mod;
  return result;
}
bool comp(const pair<int, int> pia, const pair<int, int> pib) {
  if (pia.first == pib.first)
    return pia.second > pib.second;
  else
    return pia.first > pib.first;
}
const int N = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.length();
    if (n == 1) {
      cout << "YES"
           << "\n";
      for (char x = 'a'; x <= 'z'; x++) {
        cout << x;
      }
      cout << "\n";
      continue;
    }
    map<char, set<char>> mp;
    for (int i = 0; i < s.length(); i++) {
      if (i - 1 >= 0) mp[s[i]].insert(s[i - 1]);
      if (i + 1 < n) mp[s[i]].insert(s[i + 1]);
    }
    int ch = 1;
    int num = 0;
    char st = 'a';
    for (auto x : mp) {
      if ((x.second).size() > 2) {
        ch = 0;
      }
      if ((x.second).size() == 1) {
        st = x.first;
        num++;
      }
    }
    if (!ch || num != 2) {
      cout << "NO"
           << "\n";
    } else {
      cout << "YES"
           << "\n";
      set<char> mys;
      vector<char> ans;
      mys.insert(st);
      ans.push_back(st);
      int val = 1;
      while (val <= mp.size()) {
        for (char x : mp[st]) {
          if (mys.find(x) == mys.end()) {
            mys.insert(x);
            ans.push_back(x);
            st = x;
          }
        }
        val++;
      }
      for (auto x : ans) {
        cout << x;
      }
      for (char i = 'a'; i <= 'z'; i++) {
        if (mys.find(i) == mys.end()) cout << i;
      }
      cout << "\n";
    }
  }
}