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;
unsigned long long kbit(unsigned long long n, unsigned long long k) {
  return ((n >> k) & 1);
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
bool sieve[1000000];
void SieveOfEratosthenes(int n) {
  memset(sieve, true, sizeof(sieve));
  for (int p = 2; p * p <= n; p++) {
    if (sieve[p]) {
      for (int i = p * p; i <= n; i += p) sieve[i] = false;
    }
  }
}
long long gcdEx(long long a, long long b, long long* x, long long* y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdEx(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long mmt(long long a, long long m) {
  long long x, y;
  long long g = gcdEx(a, m, &x, &y);
  if (g != 1) return 0;
  long long res = (x % m + m) % m;
  return res;
}
unsigned long long powerm(unsigned long long x, unsigned long long p,
                          unsigned long long m) {
  unsigned long long base;
  if (p == 0) return 1;
  base = powerm(x, p >> 1, m);
  if (p % 2 == 0)
    return (base % m) * (base % m) % m;
  else
    return (x % m) * ((base % m) * (base % m) % m) % m;
}
unsigned long long power(unsigned long long x, unsigned long long p) {
  unsigned long long base;
  if (p == 0) return 1;
  base = power(x, p >> 1);
  if (p % 2 == 0)
    return base * base;
  else
    return x * base * base;
}
string dfs(vector<vector<int>>& a, vector<bool>& v, int c) {
  v[c] = true;
  string res = "";
  for (int i = 0; i < a[c].size(); i++)
    if (!v[a[c][i]]) res += dfs(a, v, a[c][i]);
  return (char)('a' + c) + res;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    vector<vector<int>> a(26);
    bool flag = false;
    for (int i = 0; i < s.length(); i++) {
      int c = s[i] - 'a';
      if (i != 0) {
        int p = s[i - 1] - 'a';
        if (a[c].size() == 0)
          a[c].push_back(p);
        else if (a[c].size() == 1) {
          if (a[c][0] != p) a[c].push_back(p);
        } else {
          if (a[c][0] != p && a[c][1] != p) {
            flag = true;
            break;
          }
        }
      }
      if (i != s.length() - 1) {
        int p = s[i + 1] - 'a';
        if (a[c].size() == 0)
          a[c].push_back(p);
        else if (a[c].size() == 1) {
          if (a[c][0] != p) a[c].push_back(p);
        } else {
          if (a[c][0] != p && a[c][1] != p) {
            flag = true;
            break;
          }
        }
      }
    }
    if (flag) {
      cout << "NO\n";
      continue;
    }
    vector<int> rest;
    for (int i = 0; i < 26; i++)
      if (a[i].size() < 2) rest.push_back(i);
    vector<bool> vis(26, false);
    string res = "";
    for (int i = 0; i < rest.size(); i++) {
      if (!vis[rest[i]]) res += dfs(a, vis, rest[i]);
    }
    if (res.length() < 26)
      cout << "NO\n";
    else
      cout << "YES\n" << res << '\n';
  }
  return 0;
}