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 power(long long int x, long long int y) {
  long long int res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int tt;
  cin >> tt;
  while (tt--) {
    string a;
    set<long long int> s[26];
    vector<long long int> ans;
    long long int n, one = 0, two = 0, c = 0, id = 0;
    cin >> a;
    n = (long long int)a.size();
    if (n == 1) {
      cout << "YES\n";
      for (long long int i = 0; i <= 25; i++) {
        char c = i + 'a';
        cout << c;
      }
      cout << endl;
      continue;
    }
    for (long long int i = 1; i <= n - 1; i++)
      s[a[i] - 'a'].insert(a[i - 1] - 'a');
    for (long long int i = 0; i <= n - 2; i++)
      s[a[i] - 'a'].insert(a[i + 1] - 'a');
    for (long long int i = 0; i <= 25; i++)
      if ((long long int)s[i].size() != 0) {
        if ((long long int)s[i].size() == 1) {
          one++;
          id = i;
        } else if ((long long int)s[i].size() == 2)
          two++;
        else
          c++;
      }
    if (c > 0 || one != 2)
      cout << "NO\n";
    else {
      cout << "YES\n";
      queue<long long int> q;
      bool vis[26];
      for (long long int i = 0; i <= 25; i++) vis[i] = false;
      q.push(id);
      ans.push_back(id);
      vis[id] = true;
      while (!q.empty()) {
        long long int x = q.front(), y, z;
        q.pop();
        for (auto i : s[x]) {
          if (!vis[i]) {
            ans.push_back(i);
            vis[i] = true;
            q.push(i);
          }
        }
      }
      for (long long int i = 0; i <= 25; i++) vis[i] = false;
      for (long long int i = 0; i <= (long long int)ans.size() - 1; i++) {
        char c = ans[i] + 'a';
        cout << c;
        vis[ans[i]] = true;
      }
      for (long long int i = 0; i <= 25; i++) {
        if (!vis[i]) {
          char c = i + 'a';
          cout << c;
        }
      }
      cout << endl;
    }
  }
}