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 dfs(int p, int parent, string &ans, vector<vector<int> > v1,
         vector<int> &mark, int &br) {
  if (br == 1) {
    return;
  }
  if (mark[p] == 1) {
    return;
  }
  char c1 = 'a' + p;
  ans = ans + c1;
  mark[p] = 1;
  for (int i = 0; i < v1[p].size(); i++) {
    if (mark[v1[p][i]] == 1) {
      if (v1[p][i] != parent && parent != -1) {
        br = 1;
        return;
      }
    } else {
      dfs(v1[p][i], p, ans, v1, mark, br);
    }
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s1;
    cin >> s1;
    int l = s1.length();
    vector<vector<int> > v1(26);
    int temp;
    int br = 0;
    for (int i = 0; i < l - 1; i++) {
      char c1 = s1[i];
      char c2 = s1[i + 1];
      int p1 = c1 - 'a';
      int p2 = c2 - 'a';
      auto itr1 = find(v1[p1].begin(), v1[p1].end(), p2);
      auto itr2 = find(v1[p2].begin(), v1[p2].end(), p1);
      if (itr1 == v1[p1].end()) {
        v1[p1].push_back(p2);
        temp = p2;
      }
      if (itr2 == v1[p2].end()) {
        v1[p2].push_back(p1);
      }
      if (v1[p1].size() > 2 || v1[p2].size() > 2) {
        br = 1;
        break;
      }
    }
    if (br == 1) {
      cout << "NO\n";
      continue;
    }
    string ans;
    vector<int> mark(26, 0);
    int i1;
    for (int i = 0; i < 26; i++) {
      if (v1[i].size() == 1) {
        i1 = i;
      }
    }
    dfs(temp, -1, ans, v1, mark, br);
    if (br == 1) {
      cout << "NO\n";
      continue;
    }
    cout << "YES\n";
    for (int i = 0; i < 26; i++) {
      if (mark[i] == 0) {
        char c = 'a' + i;
        ans = ans + c;
      }
    }
    cout << ans;
    cout << "\n";
  }
}