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 long long mod = 1000000007;
const long long N = 300005;
const long long inf = 10000000000000000;
void print(vector<long long> v) {
  long long i;
  for (i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
vector<long long> read(long long n) {
  long long i;
  vector<long long> arr(n, 0);
  for (i = 0; i < n; i++) cin >> arr[i];
  return arr;
}
vector<long long> read(long long n, long long k) {
  long long i;
  vector<long long> arr(n + k, 0);
  for (i = k; i < n + k; i++) cin >> arr[i];
  return arr;
}
bool isEven(long long n) { return n % 2 == 0; }
bool isOdd(long long n) { return n % 2 != 0; }
vector<char> ans;
void topo(long long cur, vector<long long> adj[], vector<bool> &vis) {
  vis[cur] = 1;
  ans.push_back(char('a' + cur));
  for (auto next : adj[cur]) {
    if (!vis[next]) {
      topo(next, adj, vis);
    }
  }
}
void solve() {
  long long t;
  cin >> (t);
  while (t--) {
    long long i, j, k, n, m, p, q, x, y, a, b, l, r;
    string str;
    cin >> str;
    n = str.size();
    set<char> check;
    for (i = 0; i < n; i++) {
      check.insert(str[i]);
    }
    if (check.size() == 1) {
      cout << "YES\n";
      for (i = 0; i < 26; i++) {
        cout << char(i + 'a');
      }
      cout << "\n";
      continue;
    }
    vector<long long> in(26, 0);
    vector<long long> adj[26];
    for (i = 0; i < n - 1; i++) {
      if (find(adj[str[i + 1] - 'a'].begin(), adj[str[i + 1] - 'a'].end(),
               str[i] - 'a') == adj[str[i + 1] - 'a'].end() &&
          str[i + 1] != str[i]) {
        adj[str[i + 1] - 'a'].push_back(str[i] - 'a');
        adj[str[i] - 'a'].push_back(str[i + 1] - 'a');
        in[str[i] - 'a']++;
        in[str[i + 1] - 'a']++;
      }
    }
    long long ct1 = 0, ct2 = 0, ct0 = 0;
    bool ok = 1;
    for (i = 0; i < 26; i++) {
      if (in[i] == 1) {
        ct1++;
      } else if (in[i] == 2) {
        ct2++;
      } else if (in[i] == 0) {
        ct0++;
      }
    }
    if (ct1 + ct2 + ct0 != 26 || ct1 != 2) {
      cout << "NO\n";
      continue;
    }
    vector<bool> vis(26, 0);
    cout << "YES\n";
    ans.clear();
    for (i = 0; i < 26; i++) {
      if (!vis[i] && adj[i].size() == 1) {
        topo(i, adj, vis);
        break;
      }
    }
    for (i = 0; i < ans.size(); i++) {
      cout << ans[i];
    }
    for (i = 0; i < 26; i++) {
      if (!vis[i]) {
        cout << char('a' + i);
      }
    }
    cout << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  long long i, j, k, n, m, p, q, x, y, a, b, l, r;
  return 0;
}