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 double pi = 3.14159265358979323846;
const long long mxN = 2e5 + 2;
void _print(long long t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(double t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> v);
template <class T>
void _print(set<T> v);
template <class T, class V>
void _print(map<T, V> v);
template <class T>
void _print(multiset<T> v);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
vector<long long> adj[27];
long long degree[27];
bool visited[27];
vector<long long> hold;
void dfs(long long src) {
  visited[src] = true;
  hold.push_back(src);
  for (auto edge : adj[src]) {
    if (!visited[edge]) dfs(edge);
  }
}
void solve() {
  string s;
  cin >> s;
  long long n = s.length();
  memset(degree, 0, sizeof(degree));
  memset(visited, false, sizeof(visited));
  hold.clear();
  vector<vector<long long>> hehe(26, vector<long long>(26, 0));
  for (long long i = 0; i <= 25; i++) adj[i].clear();
  for (long long i = 0; i < n - 1; i++) {
    if (s[i] != s[i + 1] && hehe[s[i] - 'a'][s[i + 1] - 'a'] == 0) {
      adj[s[i] - 'a'].push_back(s[i + 1] - 'a');
      adj[s[i + 1] - 'a'].push_back(s[i] - 'a');
      hehe[s[i] - 'a'][s[i + 1] - 'a'] = 1;
      hehe[s[i + 1] - 'a'][s[i] - 'a'] = 1;
      degree[s[i + 1] - 'a']++;
      degree[s[i] - 'a']++;
    }
  }
  long long onecount = 0;
  long long pos = -1;
  if (n == 1) pos = s[0] - 'a';
  for (long long i = 0; i <= 25; i++) {
    if (degree[i] > 2) {
      cout << "NO\n";
      return;
    }
    if (degree[i] == 1) {
      onecount++;
      pos = i;
    }
  }
  if (n != 1 && onecount != 2) {
    cout << "NO\n";
    return;
  }
  cout << "YES\n";
  dfs(pos);
  for (long long i = 0; i < 26; i++) {
    if (!visited[i]) hold.push_back(i);
  }
  for (auto x : hold) cout << char(x + 'a');
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long T = 1;
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}