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 get_char_list_input():
    return list(input())

def get_int_input():
    return int(input())

class ListNode:
    def __init__(self, char, left=None, right=None):
        self.char = char;
        self.left = left
        self.right = right

    def is_occupied(self):
        return self.left and self.right

    def has_neighbor(self, node):
        return self.left == node or self.right == node

    def rotate(self):
        self.left, self.right = self.right, self.left
        if self.left:
            self.left.rotate()
        if self.right:
            self.right.rotate()

    def get_all_linked_char(self, search_left=False, search_right=False):
        linked_lst = [self.char]
        if (self.left == None or not search_left) \
            and (self.right == None or not search_right):
            return linked_lst
        if self.left and search_left:
            linked_lst = self.left.get_all_linked_char(search_left=True) + linked_lst
        if self.right and search_right:
            linked_lst = linked_lst + self.right.get_all_linked_char(search_right=True)
        return linked_lst

    def has_loop(self):
        p = self.right
        while (p is not self and p):
            p = p.right
        if p is self:
            return True
        else:
            return False


def check_password(char_list):
    char_dict = {char : ListNode(char) for char in char_list}
    for char1, char2 in zip(char_list, char_list[1:]):
        node1, node2 = char_dict[char1], char_dict[char2]
        if node1.has_neighbor(node2):
            continue
        elif node1.is_occupied() or node2.is_occupied():
            return False, None
        elif node1.right == None and node2.left == None:
            node1.right = node2
            node2.left = node1
        elif node1.right == None and node2.right == None:
            node2.rotate()
            node1.right = node2
            node2.left = node1
        elif node1.left == None and node2.right == None:
            node2.right = node1
            node1.left = node2
        else:
            node1.rotate()
            node1.right = node2
            node2.left = node1
    import string
    solution = ""
    s = set(string.ascii_lowercase)
    for char in char_dict:
        if char_dict[char].has_loop():
            return False, None
        if char in s:
            linked_lst = char_dict[char].get_all_linked_char(search_left=True, search_right=True)
            solution += "".join(linked_lst)
            s -= set(linked_lst)
    solution += "".join(s)
    return True, solution
    


def main():
    n = get_int_input()
    # print(n)
    for _ in range(n):
        char_list = get_char_list_input()
        # print(char_list)
        ok, solution = check_password(char_list)
        if ok:
            print("YES")
            print(solution)
        else:
            print("NO")

    # print('test:')
    # a = ListNode('a')
    # b = a.right = ListNode('b', left=a)
    # c = b.right = ListNode('c', left=b)
    # print(b.get_all_linked_char(search_left=True, search_right=True))

main()