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
from pprint import pprint
q = int(input())
for _ in range(q):
    s = input()
    d = dict()
    f = True
    for i in range(len(s)):
        l = d.get(s[i], [])

        if i != len(s) - 1:
            nkey = s[i+1]
        else:
            nkey = None
            #print("hit! next")
        if i != 0:
            pkey = s[i-1]
        else:
            pkey = None
            #print("hit! prev")

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

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

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

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

    # ここまでok
    #print(d)
    # build
    s = ""
    for k in d.keys():
        #print("---")
        #print(f)
        #print(s)
        #print(k)
        if s == "": # 空文字列の時
            if len(d[k]) == 0:
                s += k
                continue
            elif len(d[k]) == 1:
                s+= k + d[k][0]
                continue
            elif len(d[k]) == 2:
                s+= d[k][0] + k + d[k][1]
                continue
            else:
                pass
                #print("あり得ない")

        elif s.find(k) == -1: #その文字の位置が分かっていないのであれば
            ic1 = ic2 = -1
            if len(d[k]) == 0: #これは文字列の構造的にあり得ない
                pass
            elif 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: # もし、この文字が配置されていないのに両文字が見つかるなら無理
                #print("fff")
                f = False
                break
            elif ic1 != -1: # ic1のみを探せばいい
                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: # ic2探しの旅
                if ic2 == 0: # 先頭がその文字なら
                    s = s[k][0] + k + s
                elif ic2 == len(s) - 1: #一番後ろなら
                    s = s + k + s[k][0]
        else: # その文字がすでに配置されているならば
            #print("known")
            #print(s)
            ic = s.find(k)
            if ic == 0: # その文字が先頭にあるなら
                #print("front")
                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): # その文字が後ろにあるなら
                #print("back")
                #print(s[len(s) - 2])
                #print(d[k][0])
                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: #この場合は両方がいずれかの文字なのでok
                    pass
    #print(s)
    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")
