Server Time: Sat Feb 23, 2019 12:12 am
Welcome ( logout
1256 - Word Puzzle
  PDF (English) Statistics Forum
Time Limit: 1 second(s) Memory Limit: 32 MB

You are given a puzzle board where there are n words. Initially they are scattered. Your task is to find a order of the words such that the first character of ith word is same as the last character of the (i-1)th word (1 < i ≤ n).

For example, you are given {"abef", "pqrs", "fzzp", "zama", "pxrp"}, the solution is

zama abcf fzzp pxrp pqrs

Input

Input starts with an integer T (≤ 20), denoting the number of test cases.

Each case starts with a line containing two an integer n (1 ≤ n ≤ 1000). Each of the next n lines contains a word whose length is between 1 and 20 (inclusive). You can assume that the words contain lowercase letters only.

Output

For each case, print the case number and 'Yes' if such a ordering can be possible, or 'No' if there is no such ordering. If the result is yes, then in the next line you should print the n words in a valid order. Print a single space between two consecutive words. There can be multiple solutions, any valid one will do.

Sample Input

Output for Sample Input

2

5

abcf

pqrs

fzzp

zama

pxrp

3

yes

no

notsolvable

Case 1: Yes

zama abcf fzzp pxrp pqrs

Case 2: No

Note

This is a special judge problem. Wrong output format may cause wrong answer.


Problem Setter: Jane Alam Jan
Developed and Maintained by
JANE ALAM JAN
Copyright © 2012
LightOJ, Jane Alam Jan