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:
q = int(input())
for _ in range(q):
    s = input()
    d = dict()
    f = True
    # STEP1: 入力文字列から隣り合う文字の関係を作る
    for i in range(len(s)):

        # 前後の文字を得る
        nkey = s[i + 1] if i != len(s) - 1 else None
        pkey = s[i - 1] if i != 0 else None

        l = d.get(s[i], [])

        # 前の文字がすでに隣接関係に登録されていないなら
        if pkey is not None and pkey not in l:
            # 文字を入れたいのにすでに両端が他の文字と指定されているなら不可能
            if len(l) >= 2:
                f = False
                break
            l.append(pkey)
            d[s[i]] = l

            l2 = d.get(pkey, [])
            if s[i] not in l2:
                if len(l2) >= 2:
                    f = False
                    break
                l2.append(s[i])
                d[pkey] = l2

        if nkey is not None and nkey not in l:
            # 文字を入れたいのにすでに両端が他の文字と指定されているなら不可能
            if len(l) >= 2:
                f = False
                break
            l.append(nkey)
            d[s[i]] = l

            l2 = d.get(nkey, [])
            if s[i] not in l2:
                # 文字を入れたいのにその左右がreserveされているなら
                if len(l2) >= 2:
                    f = False
                    break
                l2.append(s[i])
                d[nkey] = l2


    s = ""
    for k in d.keys():
        if s == "":  # 空文字列の時
            if len(d[k]) == 0:
                s += k
            elif len(d[k]) == 1:
                s += k + d[k][0]
            elif len(d[k]) == 2:
                s += d[k][0] + k + d[k][1]
        elif s.find(k) == -1:
            ic1 = ic2 = -1
            if len(d[k]) == 1:
                ic1 = s.find(d[k][0])
            elif len(d[k]) == 2:
                ic1 = s.find(d[k][0])
                ic2 = s.find(d[k][1])

            if ic1 != -1 and ic2 != -1:
                f = False
            elif ic1 != -1:
                if ic1 == 0:
                    s = k + s 
                    if len(d[k]) == 2: 
                        s = d[k][1] + s 
                elif ic1 == len(s) - 1:  
                    s = s + k
                    if len(d[k]) == 2:
                        s = s + d[k][1]

            elif ic2 != -1: 
                if ic2 == 0: 
                    s = s[k][0] + k + s 
                elif ic2 == len(s) - 1:  
                    s = s + k + s[k][0] 

        else:  
            ic = s.find(k)
            if ic == 0:  
                if len(d[k]) == 2 and s[1] == d[k][0]: 
                    if d[k][1] in s: 
                        f = False
                    s = d[k][1] + s
                elif len(d[k]) == 2 and s[1] == d[k][1]:
                    if d[k][0] in s:
                        f = False
                    s = d[k][0] + s
                elif len(d[k]) == 2: 
                    f = False
                elif len(d[k]) == 1 and s[1] == d[k][0]:
                    pass 
                else: 
                    f = False
            elif ic == (len(s) - 1):  
                if len(d[k]) == 2 and s[len(s) - 2] == d[k][0]:
                    if d[k][1] in s:
                        f = False
                    s = s + d[k][1]
                elif len(d[k]) == 2 and s[len(s) - 2] == d[k][1]:
                    if d[k][0] in s:
                        f = False
                    s = s + d[k][0]
                elif len(d[k]) == 2:
                    f = False
                elif len(d[k]) == 1 and s[len(s) - 2] == d[k][0]:
                    pass  # 正常
                else:
                    f = False
                    pass
            else:  
                if s[ic - 1] not in d[k] or s[ic + 1] not in d[k]:
                    f = False
                else:
                    pass

    if f:
        list_lower = ['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 c in list_lower:
            if c not in s:
                s = s + c
        print("YES")
        print(s)
    else:
        print("NO")