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;
#pragma warning(disable : 4996)
const long long N = 2e5 + 5;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long po(long long x, long long y, long long p = mod) {
  long long res = 1;
  x %= p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long inv(long long x, long long p = mod) { return po(x, p - 2); }
void solve() {
  string s;
  cin >> s;
  map<char, vector<char>> adj;
  bool poss = true;
  if (s.size() == 1) {
    cout << "YES"
         << "\n";
    char c = 'a';
    for (long long i = 0; i < 26; i++) {
      cout << char(c + i);
    }
    return;
  }
  for (long long i = 0; i < s.size() - 1; i++) {
    if (adj[s[i]].size() == 0) {
      adj[s[i]].push_back(s[i + 1]);
    } else if (adj[s[i]].size() == 1 && adj[s[i]][0] != s[i + 1]) {
      adj[s[i]].push_back(s[i + 1]);
    } else if (adj[s[i]].size() == 2 && adj[s[i]][0] != s[i + 1] &&
               adj[s[i]][1] != s[i + 1]) {
      poss = false;
      break;
    }
    if (adj[s[i + 1]].size() == 0) {
      adj[s[i + 1]].push_back(s[i]);
    } else if (adj[s[i + 1]].size() == 1 && adj[s[i + 1]][0] != s[i]) {
      adj[s[i + 1]].push_back(s[i]);
    } else if (adj[s[i + 1]].size() == 2 && adj[s[i + 1]][0] != s[i] &&
               adj[s[i + 1]][1] != s[i]) {
      poss = false;
      break;
    }
  }
  vector<char> be;
  for (auto& let : adj) {
    if (let.second.size() == 1) {
      be.push_back(let.first);
    }
  }
  if (be.size() != 2) {
    poss = false;
  }
  if (!poss) {
    cout << "NO";
  } else {
    cout << "YES"
         << "\n";
    map<char, long long> done;
    done[be[0]] = 1;
    string s = string(1, be[0]);
    char c = adj[be[0]][0];
    while (c != be[1]) {
      done[c] = 1;
      s += string(1, c);
      if (done[adj[c][0]] != 1) {
        c = adj[c][0];
      } else {
        c = adj[c][1];
      }
    }
    s += string(1, be[1]);
    done[be[1]] = 1;
    for (long long i = 0; i < 26; i++) {
      char temp = 'a' + i;
      if (done[temp] != 1) {
        s += string(1, temp);
      }
    }
    cout << s;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long t = 0;
  long long test_cases = 1;
  cin >> test_cases;
  while (t++ < test_cases) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}