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>
#pragma GCC optimize(3)
void readint() {}
template <class T1, class... T2>
void readint(T1 &i, T2 &...rest) {
  i = 0;
  char c;
  bool f = false;
  while (!isdigit(c = getchar())) f = c == '-';
  do i = (i << 3) + (i << 1) + c - '0';
  while (isdigit(c = getchar()));
  if (f) i = -i;
  readint(rest...);
}
using namespace std;
int t;
bool m[28][28];
bool vis[28];
int d[28];
char s[205];
bool flag = 1;
void dfs(int u, int fa) {
  if (vis[u]) {
    flag = 0;
    return;
  }
  vis[u] = 1;
  for (int v = 1; v <= 26; ++v) {
    if (v == fa) continue;
    if (m[u][v] == 0) continue;
    dfs(v, u);
  }
}
void dfs2(int u, int fa) {
  vis[u] = 1;
  cout << (char)('a' + u - 1);
  for (int v = 1; v <= 26; ++v) {
    if (v == fa) continue;
    if (m[u][v] == 0) continue;
    dfs2(v, u);
  }
}
int main() {
  cin >> t;
  while (t--) {
    memset(m, 0, sizeof(m));
    memset(d, 0, sizeof(d));
    memset(vis, 0, sizeof(vis));
    cin >> (s + 1);
    int n = strlen(s + 1);
    for (int i = 1; i < n; ++i) {
      m[s[i] - 'a' + 1][s[i + 1] - 'a' + 1] = 1;
      m[s[i + 1] - 'a' + 1][s[i] - 'a' + 1] = 1;
    }
    for (int i = 1; i <= 26; ++i)
      for (int j = 1; j <= 26; ++j)
        if (m[i][j]) d[i]++;
    flag = 1;
    for (int i = 1; i <= 26; ++i) {
      if (d[i] > 2) flag = 0;
      if (vis[i] == 0) dfs(i, 0);
    }
    if (flag == 0) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
      memset(vis, 0, sizeof(vis));
      for (int i = 1; i <= 26; ++i) {
        if (vis[i]) continue;
        if (d[i] == 2 || d[i] == 0) continue;
        dfs2(i, 0);
      }
      for (int i = 1; i <= 26; ++i) {
        if (d[i] == 0) cout << (char)('a' + i - 1);
      }
      cout << endl;
    }
  }
  return 0;
}