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>
int parent[26];
bool visited[26];
std::vector<int> graph[26];
int Find(int x) {
  if (x == parent[x]) return x;
  parent[x] = Find(parent[x]);
  return parent[x];
}
void Union(int x, int y) {
  int xPar = Find(x);
  int yPar = Find(y);
  parent[xPar] = yPar;
}
void DFS(int start) {
  visited[start] = true;
  std::cout << (char)(start + 'a');
  for (int next : graph[start])
    if (!visited[next]) DFS(next);
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  int T;
  std::cin >> T;
  while (T--) {
    for (int i = 0; i < 26; ++i) {
      parent[i] = i;
      graph[i].clear();
      visited[i] = false;
    }
    std::string str;
    std::cin >> str;
    std::set<std::pair<char, char>> adj;
    for (int i = 0; i < (int)str.size() - 1; ++i) {
      char u = str[i], v = str[i + 1];
      if (u > v) std::swap(u, v);
      adj.insert({u, v});
    }
    bool valid = true;
    for (auto p : adj) {
      char u = p.first, v = p.second;
      if (Find(u - 'a') == Find(v - 'a'))
        valid = false;
      else {
        graph[u - 'a'].push_back(v - 'a');
        graph[v - 'a'].push_back(u - 'a');
        Union(u - 'a', v - 'a');
      }
      if (!valid) break;
    }
    for (int i = 0; i < 26 && valid; ++i)
      if (graph[i].size() >= 3) valid = false;
    if (!valid)
      std::cout << "NO\n";
    else {
      std::cout << "YES\n";
      for (int i = 0; i < 26; ++i)
        if (!visited[i] && graph[i].size() < 2) DFS(i);
      std::cout << '\n';
    }
  }
  return 0;
}