12141 - Ugandan Knuckles's code   

Description

Ugandan Knuckles is trapped in a dungeon. He wants to find his queen. He finds a stele (碑) that there are n strings on it. You can move the strings in any order you want.


The way to go out is that for each string, all strings placed before it are its substrings.

For example:

If the stele contains strings:

"n"

"ugandan"

"ganda"

"gan"

You should arrange the strings into the order:

"n"

"gan"

"ganda"

"ugandan"

 

Help Knuckles get out of the dungeon or he will spit on you.

Input

Input contains several lines.

First line contains only one integer (1<= n <= 1000)

Following n lines, each line contains one string s ( 1<= length of s <= 1000 )

The string s only contains lowercase English letters.

 

Output

If it's impossible to arrange the strings in the desired order, print "NO".

If it's possible, print "YES" .

And then print n lines each line contains one string in required order.

Remember to print \n at the end of output.

Sample Input  Download

Sample Output  Download

Tags




Discuss