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 PYTHON3):

Solution:
def iinput():
    return [int(x) for x in input().split()]


def main():
    global alp1
    s = input()
    klav = s[0]
    alp = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0,
           'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0,
           't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
    pos = 0
    alp[s[0]] = 1
    for j in range(1, len(s)):
        if alp[s[j]] > 0:
            if pos == 0:
                if klav[1] != s[j]:
                    return 'NO'
                pos = 1
            elif pos == len(klav) - 1:
                if klav[-2] != s[j]:
                    return 'NO'
                pos = len(klav) - 2
            else:
                if klav[pos + 1] != s[j] and klav[pos - 1] != s[j]:
                    return 'NO'
                elif klav[pos + 1] == s[j]:
                    pos += 1
                else:
                    pos -= 1
        elif klav[0] == s[j - 1]:
            klav = s[j] + klav
            pos = 0
            alp[s[j]] += 1
        elif klav[-1] == s[j - 1]:
            pos = len(klav)
            klav += s[j]
            alp[s[j]] += 1
        else:
            return 'NO'
    print('YES')
    for j in range(26):
        if alp[alp1[j]] == 0:
            klav += alp1[j]
    return klav


alp1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
        'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
        't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(int(input())):
    print(main())