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;
template <typename T = int>
inline const T read() {
  T x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
template <typename T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
bool vis[128];
const int maxn = 2e3;
char kb[maxn];
int pos[maxn];
int main() {
  int t = read();
  while (t--) {
    string s;
    cin >> s;
    int len = (int)s.length();
    memset(kb, 0, sizeof(kb));
    memset(vis, false, sizeof(vis));
    bool flag = true;
    if (len == 1) {
      cout << "YES" << endl;
      cout << s[0];
      for (int i = 'a'; i <= 'z'; i++)
        if (i != s[0]) cout << (char)i;
      cout << endl;
    } else {
      kb[1000] = s[0];
      kb[999] = s[1];
      vis[s[0]] = vis[s[1]] = true;
      pos[0] = 1000;
      pos[1] = 999;
      if (s[0] == s[1]) {
        flag = false;
        break;
      }
      for (int i = 2; i < len; i++) {
        if (vis[s[i]]) {
          if (s[i] == kb[pos[i - 1] - 1])
            pos[i] = pos[i - 1] - 1;
          else if (s[i] == kb[pos[i - 1] + 1])
            pos[i] = pos[i - 1] + 1;
          else {
            flag = false;
            break;
          }
        } else {
          vis[s[i]] = true;
          if (kb[pos[i - 1] - 1] == 0) {
            pos[i] = pos[i - 1] - 1;
            kb[pos[i]] = s[i];
          } else if (kb[pos[i - 1] + 1] == 0) {
            pos[i] = pos[i - 1] + 1;
            kb[pos[i]] = s[i];
          } else {
            flag = false;
            break;
          }
        }
      }
      if (!flag)
        cout << "NO" << endl;
      else {
        string ans;
        for (int i = 0; i < 2000; i++)
          if (kb[i]) ans.push_back(kb[i]);
        if (ans.size() > 26) {
          cout << "NO" << endl;
          continue;
        }
        cout << "YES" << endl;
        cout << ans;
        for (int i = 'a'; i <= 'z'; i++)
          if (!vis[i]) cout << (char)i;
        cout << endl;
      }
    }
  }
  return 0;
}