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;
int main() {
  long long int a, b, c, d, i, j, k, l;
  scanf("%lld", &a);
  while (a--) {
    char s1[205];
    long long int arr1[30][30];
    scanf("%s", &s1);
    b = strlen(s1);
    memset(arr1, 0, sizeof(arr1));
    for (i = 0; i < b - 1; i++) {
      arr1[s1[i] - 'a'][s1[i + 1] - 'a'] = 1;
      arr1[s1[i + 1] - 'a'][s1[i] - 'a'] = 1;
    }
    if (b == 1) {
      printf("YES\n");
      printf("%c", s1[0]);
      for (i = 0; i < 26; i++)
        if (s1[0] != i + 'a') printf("%c", 'a' + i);
      printf("\n");
      continue;
    }
    k = 0;
    l = 0;
    for (i = 0; i < 26; i++) {
      c = 0;
      for (j = 0; j < 26; j++) {
        c += arr1[i][j];
      }
      if (c > 0) l = 1;
    }
    if (l == 0) {
      printf("YES\n");
      char x = 'a';
      for (i = 0; i < 25; i++) printf("%c", x + i);
      printf("\n");
      continue;
    }
    k = 0;
    l = 0;
    for (i = 0; i < 26; i++) {
      c = 0;
      for (j = 0; j < 26; j++) {
        c += arr1[i][j];
      }
      if (c > 2) break;
      if (c == 1) {
        k = i;
        l++;
      }
    }
    if (l != 2 || c > 2) {
      printf("NO\n");
      continue;
    }
    char s2[206];
    printf("YES\n");
    printf("%c", k + 'a');
    l = 0;
    long long int g[30];
    memset(g, 0, sizeof(g));
    g[k] = 1;
    while (1) {
      for (i = 0; i < 26; i++) {
        if (arr1[k][i]) {
          arr1[i][k] = 0;
          arr1[k][i] = 0;
          break;
        }
      }
      if (i == 26) break;
      printf("%c", i + 'a');
      g[i] = 1;
      k = i;
    }
    for (i = 0; i < 26; i++)
      if (g[i] == 0) printf("%c", i + 'a');
    printf("\n");
  }
  return 0;
}