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 double PI = 3.1415926535897923846;
const long long int MOD = 1000000007;
const long long int N = 998244353;
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
long long int modinverse(long long int a) { return power(a, MOD - 2); }
vector<vector<long long int> > adj;
vector<long long int> col(26);
bool vis[26];
bool dfs(long long int node, long long int parent) {
  col[node] = 1;
  for (auto x : adj[node]) {
    if (x == parent) continue;
    if (col[x] == 0) {
      if (dfs(x, node)) return true;
    } else if (col[x] == 1) {
      return true;
    }
  }
  col[node] = 2;
  return false;
}
void dsf(long long int node, long long int parent) {
  vis[node] = true;
  char ch = 'a' + node;
  cout << ch;
  for (auto x : adj[node]) {
    if (x == parent) continue;
    dsf(x, node);
  }
}
void solve() {
  string str;
  cin >> str;
  for (long long int i = 0; i < 26; i++) col[i] = 0;
  for (long long int i = 0; i < 26; i++) vis[i] = false;
  adj.clear();
  adj.resize(26);
  map<pair<long long int, long long int>, long long int> mp1;
  for (long long int i = 1; i <= (long long int)str.length() - 1; i++) {
    long long int u = str[i] - 'a';
    long long int v = str[i - 1] - 'a';
    if (u == v) continue;
    if (mp1.find({u, v}) != mp1.end()) continue;
    mp1[{u, v}]++, mp1[{v, u}]++;
    adj[u].push_back(v), adj[v].push_back(u);
    if (max((long long int)adj[u].size(), (long long int)adj[v].size()) > 2) {
      cout << "NO\n";
      return;
    }
  }
  for (long long int i = 0; i < 26; i++) {
    if (col[i] == 0 && dfs(i, -1)) {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
  for (long long int i = 0; i < 26; i++) vis[i] = false;
  for (long long int i = 0; i < 26; i++) {
    if (!vis[i]) {
      if ((long long int)adj[i].size() <= 1) dsf(i, -1);
    }
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int test = 1;
  cin >> test;
  while (test--) {
    solve();
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}