from sys import stdin, stdout
import math

q = int(stdin.readline())


for x in range(q):
    bool1 = False
    alphabet = "abcdefghijklmnopqrstuvwxyz"
    keyboard = []
    password = stdin.readline()
    if not bool1:
        temp = password[:-1]
        print(temp)
        temp1 = temp[::-1]
        print(temp1)
        if temp1 == temp:
            print("dsfsdf")
            bool1 = True
    #print(password)
    for y in range(0,len(password)-1):
        if not password[y] in keyboard:
            if len(keyboard) == 0:
                keyboard.append(password[y])
            else:
                temp = keyboard.index(password[y-1])
                if temp == 0:
                    keyboard.insert(temp, password[y])
                else:
                    keyboard.insert(temp+2, password[y])
        else:
            temp = keyboard.index(password[y])
            if 0<temp<len(keyboard)-1:
                if keyboard[temp+1] != password[y+1] and keyboard[temp+1] != password[y-1] and keyboard[temp-1] != password[y+1] and keyboard[temp-1] != password[y-1]:
                    bool1 = True
            if temp == 0:
                if keyboard[temp + 1] != password[y + 1] and keyboard[temp + 1] != password[y - 1]:
                    bool1 = True
            if temp == len(keyboard)-1:
                if keyboard[temp-1] != password[y+1] and keyboard[temp-1] != password[y-1]:
                    bool1 = True

    for each in alphabet:
        if not each in keyboard:
            keyboard.append(each)

    #print(password[0])
    #print(len(password)-1)
    if not bool1:
        if password == password[::-1]:
            bool1 = True
    #if password[0] == password[len(password)-2] and password.count(password[0]) % 2 == 0:
        #bool1 = True
    if bool1:
        print("NO")
    else:
        print("YES")
        print(*keyboard, sep='')
