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 int n, m;
long long int arr[200000];
string st;
bool pos;
set<char> adj[26];
bool usd[26];
string rec(char ch, long long int siz, long long int dir) {
  long long int val = 0;
  if (!adj[ch - 'a'].empty())
    for (auto it : adj[ch - 'a'])
      if (usd[it - 'a']) {
        val++;
      }
  if (adj[ch - 'a'].size() - ((siz == 1) ? 1 : 0) > siz) {
    pos = false;
  }
  long long int cur = 0;
  string ret, fron, bac;
  ret.push_back(ch);
  usd[ch - 'a'] = true;
  long long int cou = 0;
  if (!adj[ch - 'a'].empty())
    for (auto it : adj[ch - 'a']) {
      if (usd[it - 'a']) {
        cou++;
        continue;
      }
      if (cur == 0) {
        fron = rec(it, 1, 0);
        cur++;
      } else {
        bac = rec(it, 1, 1);
        if (siz == 1) pos = false;
      }
    }
  if (cou > 1) pos = false;
  ret += fron;
  ret = bac + ret;
  if (dir) reverse(ret.begin(), ret.end());
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int TESTS, q, a, s, b, r, l, k, c, p, h, w, d, x, y, z, xs, ys, t;
  TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    for (long long int i = 0; i <= 25; i++) usd[i] = false;
    for (long long int i = 0; i <= 25; i++) adj[i].clear();
    cin >> st;
    n = st.size();
    for (long long int i = 1; i <= n - 2; i++) {
      if (st[i] != st[i - 1]) adj[st[i] - 'a'].insert(st[i - 1]);
      if (st[i] != st[i + 1]) adj[st[i] - 'a'].insert(st[i + 1]);
    }
    if (n > 1) {
      if (st[0] != st[1]) adj[st[0] - 'a'].insert(st[1]);
      if (st[n - 1] != st[n - 2]) adj[st[n - 1] - 'a'].insert(st[n - 2]);
    }
    pos = true;
    string ans = rec(st[0], 2, 0);
    if (pos)
      cout << "YES\n" << ans;
    else {
      cout << "NO\n";
      continue;
    }
    for (long long int i = 0; i <= 25; i++)
      if (!usd[i]) {
        char cha = 'a';
        cha += i;
        cout << cha;
      }
    cout << "\n";
  }
  return 0;
}