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 make(i,dir1 = 0):
    global neighs
    global ans
    #print(ans)
    used[i] = 1
    first = True
    if dir1 == 0:
        for letter in neighs[i]:
            if first:
                used[letter] = 1
                ans = letter + ans
                make(letter,-1)
                first = False
            else:
                used[letter] = 1
                ans += letter
                make(letter,1)
    elif dir1 == -1:
        if len(neighs[i])>0:
            for letter in neighs[i]:
                if first and not used[letter]:
                    used[letter] = 1
                    ans = ans[:ans.index(i)]+letter+ans[ans.index(i):]
                    make(letter,-1)
                    first = False
                elif not used[letter]:
                    used[letter] = 1
                    ans = ans[0:ans.index(i)+1]+letter+ans[ans.index(i)+1:]
                    make(letter,1)
    else:
        if len(neighs[i])>0:
            for letter in neighs[i]:
                if first and not used[letter]:
                    used[letter] = 1
                    ans = ans[0:ans.index(i)+1]+letter+ans[ans.index(i)+1:]
                    make(letter,1)
                    first = False
                elif not used[letter]:
                    used[letter] = 1
                    ans = ans[:ans.index(i)]+letter+ans[ans.index(i):]
                    make(letter,-1)
def isValid(s):
    s = ' '+s+' '
    for i in range(1,len(s)-1):
        neighbors = [s[i-1],s[i+1]]
        for j in neighs[s[i]]:
            if j not in neighbors:
                return False
    return True
t = int(input())
for j in range(t):
    neighs = {'a':set(),
          'b':set(),
          'c':set(),
          'd':set(),
          'e':set(),
          'f':set(),
          'g':set(),
          'h':set(),
          'i':set(),
          'j':set(),
          'k':set(),
          'l':set(),
          'm':set(),
          'n':set(),
          'o':set(),
          'p':set(),
          'q':set(),
          'r':set(),
          's':set(),
          't':set(),
          'u':set(),
          'v':set(),
          'w':set(),
          'x':set(),
          'y':set(),
          'z':set()
    }
    used = {'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
            }
    s = input()
    if len(s)>1:
        neighs[s[0]].add(s[1])
        neighs[s[len(s)-1]].add(s[len(s)-2])
        for i in range(1,len(s)-1):
            neighs[s[i]].add(s[i-1])
            neighs[s[i]].add(s[i+1])
    counter = 0
    max1 = 0
    for i in neighs.keys():
        max1 = max(max1,len(neighs[i]))
        if len(neighs[i])<2:
            counter += 1
    first = True
    for i in neighs.keys():
        if first:
            ans = i
            make(i)
            first = False
        else:
            if not used[i]:
                ans += i
                make(i,1)
    if isValid(ans):
        print('YES')
        print(ans)
    else:
        print('NO')