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 double EPS = 1e-9;
const double PI = 3.14159265359;
vector<long long> primes;
void GeneratingPrimes(int top) {
  vector<bool> p(top + 1, 1);
  p[0] = p[1] = 0;
  for (int i = 2; i <= sqrt(top); i++) {
    if (p[i]) {
      for (int j = i * i; j <= top; j += i) {
        p[j] = 0;
      }
    }
  }
  for (int i = 0; i < top + 1; i++)
    if (p[i]) primes.push_back(i);
}
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
void EXTgcd(long long a, long long b, int& x0, int& y0) {
  if (b == 0) {
    x0 = 1, y0 = 0;
    return;
  }
  EXTgcd(b, a % b, x0, y0);
  long long x1 = y0;
  long long y1 = x0 - (a / b) * y0;
  x0 = x1;
  y0 = y1;
}
long long power(long long n, long long p, long long mod) {
  if (!p) return 1;
  long long ans = 1;
  while (p > 1) {
    if (p & 1) ans = (ans * n) % mod;
    n = (n * n) % mod;
    p /= 2;
  }
  return (ans * n) % mod;
}
double dist(double a, double b, double x, double y) {
  return sqrt(pow(a - x, 2) + pow(b - y, 2));
}
double dist3(double a, double b, double c, double x, double y, double z) {
  return sqrt(pow(a - x, 2) + pow(b - y, 2) + pow(c - z, 2));
}
int xadd[9] = {1, -1, 0, 1, -1, 0, 1, -1, 0};
int yadd[9] = {1, -1, 0, -1, 0, 1, 0, 1, -1};
int xx[4] = {0, 1, 0, -1};
int yy[4] = {1, 0, -1, 0};
long long const N = 5e3 + 10;
long long const mod = 1e9 + 7;
long long const INF = 1e12;
int t;
int main() {
  cin >> t;
  while (t--) {
    string s, ans = "";
    cin >> s;
    int vis[26] = {0}, idx = 0, ok = 1;
    vis[s[0] - 'a'] = 1;
    ans += s[0];
    for (int i = 1; i < s.size(); i++) {
      if (vis[s[i] - 'a']) {
        if (idx && s[i] == ans[idx - 1])
          idx--;
        else if (idx < ans.size() - 1 && s[i] == ans[idx + 1])
          idx++;
        else {
          ok = 0;
          break;
        }
      } else {
        vis[s[i] - 'a'] = 1;
        if (idx && idx < ans.size() - 1) {
          ok = 0;
          break;
        }
        if (!idx)
          ans = s[i] + ans;
        else
          ans += s[i], idx++;
      }
    }
    if (!ok) {
      { cout << "NO\n"; };
      continue;
    }
    for (int i = 0; i < 26; i++)
      if (!vis[i]) ans += char(i + 'a');
    { cout << "YES\n"; };
    cout << ans << endl;
  }
  return 0;
}