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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.TreeMap;

public final class Main
{

	public static void main(String[] args) throws IOException
	{
		Scanner in = getScan(args);
		int t = in.nextInt();

		while (t-- > 0)
		{
			String s = in.next();
			int n = s.length();
			boolean poss = true;

			TreeMap<Integer, Node> m = new TreeMap<>();
			Node prev = null;

			for (int i = 0; i < n; i++)
			{
				int c = s.charAt(i);
				Node curr = m.get(c);
				if (!m.containsKey(c))
				{
					curr = new Node(c, null, null);
					m.put(c, curr);
					if (prev != null)
					{
						if (prev.next == null)
						{
							prev.next = curr;
							curr.prev = prev;
						}
						else if (prev.prev == null)
						{
							prev.prev = curr;
							curr.next = prev;
						}
						else
						{
							poss = false;
							break;
						}
					}
				}
				else if (curr.prev != prev && curr.next != prev)
				{
					poss = false;
					break;
				}
				prev = curr;
			}
			if (!poss)
			{
				System.out.println("NO");
				continue;
			}
			System.out.println("YES");
			Node curr = m.firstEntry().getValue();
			boolean[] used = new boolean[26];
			while (curr.prev != null)
			{
				curr = curr.prev;
			}
			while (curr != null)
			{
				used[curr.i - 'a'] = true;
				char c = (char) curr.i;
				System.out.print(c);
				curr = curr.next;
			}
			for (int i = 0; i < 26; i++)
			{
				if (!used[i])
				{
					System.out.print((char) (i + 'a'));
				}
			}
			System.out.println();
		}
	}

	static class Node
	{
		int i;
		Node prev;
		Node next;

		Node(int i, Node prev, Node next)
		{
			this.i = i;
			this.prev = prev;
			this.next = next;
		}

		@Override
		public String toString()
		{
			return Integer.toString(i);
		}
	}

	public static int log2nlz(int bits)
	{
		if (bits == 0) return 0; // or throw exception
		return 31 - Integer.numberOfLeadingZeros(bits);
	}

	static Scanner getScan(String[] args) throws IOException
	{
		if (args.length == 0)
		{
			return new Scanner(System.in);
		}
		else
		{
			return new Scanner(new File(args[0]));
		}
	}

	static BufferedReader getBuffer(String[] args) throws IOException
	{
		if (args.length == 0)
		{
			return new BufferedReader(new InputStreamReader(System.in));
		}
		else
		{
			return new BufferedReader(new FileReader(args[0]));
		}
	}

}