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;
void fun() {
  string str;
  cin >> str;
  int flag[26] = {0};
  int sz = str.length();
  string a;
  a.clear();
  long long naruto = 5;
  while (naruto) {
    naruto--;
  }
  int c = 0;
  a = a + str[0];
  flag[str[0] - 'a'] = 1;
  int j;
  naruto = 5;
  while (naruto) {
    naruto--;
  }
  for (j = 1; j < sz; j++) {
    if (c == 0) {
      if (a.length() > 1) {
        if (a[1] == str[j])
          c++;
        else {
          if (flag[str[j] - 'a'] == 1) {
            cout << "NO\n";
            break;
          } else {
            a = str[j] + a;
            flag[str[j] - 'a'] = 1;
          }
        }
      } else {
        a += str[j];
        c++;
        flag[str[j] - 'a'] = 1;
      }
      naruto = 5;
      while (naruto) {
        naruto--;
      }
      continue;
    } else if (c == a.length() - 1) {
      if (a[a.length() - 2] == str[j])
        c--;
      else {
        if (flag[str[j] - 'a'] == 1) {
          cout << "NO\n";
          break;
        } else {
          a = a + str[j];
          flag[str[j] - 'a'] = 1;
          c++;
        }
      }
      continue;
    } else {
      if (str[j] == a[c - 1])
        c--;
      else if (str[j] == a[c + 1])
        c++;
      else {
        cout << "NO\n";
        break;
      }
    }
  }
  naruto = 5;
  while (naruto) {
    naruto--;
  }
  if (j == sz) {
    cout << "YES\n";
    cout << a;
    for (j = 0; j < 26; j++) {
      if (flag[j] == 0) cout << (char)(j + 'a');
    }
    cout << endl;
  }
}
int main() {
  long long q;
  cin >> q;
  while (q--) {
    fun();
  }
  return 0;
}