You are given n strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such a way that for every string, all strings that are placed before it are its substrings.

String a is a substring of string b if it is possible to choose several consecutive letters in b in such a way that they form a. For example, string "for" is contained as a substring in strings "codeforces", "for" and "therefore", but is not contained as a substring in strings "four", "fofo" and "rof".

Input

The first line contains an integer n (1 ≤ n ≤ 100) — the number of strings.

The next n lines contain the given strings. The number of letters in each string is from 1 to 100, inclusive. Each string consists of lowercase English letters.

Some strings might be equal.

Output

If it is impossible to reorder n given strings in required order, print "NO" (without quotes).

Otherwise print "YES" (without quotes) and n given strings in required order.

Examples

Input

5
a
aba
abacaba
ba
aba


Output

YES
a
ba
aba
aba
abacaba


Input

5
a
abacaba
ba
aba
abab


Output

NO


Input

3
qwerty
qwerty
qwerty


Output

YES
qwerty
qwerty
qwerty

Note

In the second example you cannot reorder the strings because the string "abab" is not a substring of the string "abacaba".
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class BBBBB {
	static class UnionFind {                                              
		int[] p, rank, setSize;
		int numSets;

		public UnionFind(int N) 
		{
			p = new int[numSets = N];
			rank = new int[N];
			setSize = new int[N];
			for (int i = 0; i < N; i++) {  p[i] = i; setSize[i] = 1; }
		}

		public int findSet(int i) { return p[i] == i ? i : (p[i] = findSet(p[i])); }

		public boolean isSameSet(int i, int j) { return findSet(i) == findSet(j); }

		public void unionSet(int i, int j) 
		{ 
			if (isSameSet(i, j)) 
				return;
			numSets--; 
			int x = findSet(i), y = findSet(j);
			if(rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else
			{	p[x] = y; setSize[y] += setSize[x];
				if(rank[x] == rank[y]) rank[y]++; 
			} 
		}

		public int numDisjointSets() { return numSets; }

		public int sizeOfSet(int i) { return setSize[findSet(i)]; }
	}
public static void main(String[] args) throws IOException{
	Scanner sc =new Scanner(System.in);
	TreeMap<String,Integer> tm =new TreeMap<String,Integer>();
	int n = sc.nextInt();
	String []elm =new String[n];
	TreeSet<String> ts =new TreeSet<String>();
	for (int i = 0; i < elm.length; i++) {
		elm[i] =sc.nextLine();
		if(tm.containsKey(elm[i]))
		{
			int count = tm.get(elm[i]);
			count++;
			tm.put(elm[i], count);
		}else
			tm.put(elm[i],1);
		ts.add(elm[i]);
	}
	UnionFind uf =new UnionFind(ts.size());
	int [] counter = new int[ts.size()];
	TreeMap<String, Integer> idx =new TreeMap<String, Integer>();
	TreeMap<Integer,String> rev =new TreeMap<Integer,String>();
		int count = 0;
	for(String s: ts) {
		rev.put(count, s);
		idx.put(s, count++);
	}

	for (String s: ts) {
		for(String t: ts) {
			if(s.contains(t)) {
				if(s.equals(t))
					continue;
//				System.out.println(s+" "+t);
				counter[idx.get(s)]++;
				uf.unionSet(idx.get(s), idx.get(t));
			}
		}
	}
//	System.out.println(Arrays.toString(uf.p));
	ArrayList<Integer>[] un =new ArrayList[ts.size()];
	for (int i = 0; i < un.length; i++) {
		un[i]= new ArrayList<Integer>();
	}
	for (int i = 0; i < uf.p.length; i++) {
		un[uf.p[i]].add(i);
	}
//	System.out.println(Arrays.toString(uf.p));
	boolean poss = true;
	// now the question is to find if they all contain same sizes
	for (int i = 0; i < un.length; i++) {
		ArrayList<Integer> cur =un[i];
		HashSet<Integer> counts =new HashSet<Integer>();
		for (int j = 0; j < cur.size(); j++) {
			counts.add(counter[cur.get(j)]);
		}
//		System.out.println(counts);
		if(counts.size()!=cur.size()) {
			poss= false;
			break;
		}
	} 
	if(uf.numSets!=1)
		poss=false;
	if(poss) {
		System.out.println("YES");
		for (int i = 0; i < un.length; i++) {
			ArrayList<Integer> cur =un[i];
			HashSet<Integer> counts =new HashSet<Integer>();
			String [] print =new String[cur.size()];
			for (int j = 0; j <cur.size(); j++) {
				counts.add(counter[cur.get(j)]);
				print[counter[cur.get(j)]]=rev.get(cur.get(j));
			}
			for (int j = 0; j < print.length; j++) {
//				System.out.println(print[j]);
				int c = tm.get(print[j]);
				for (int k = 0; k < c; k++) {
					System.out.println(print[j]);
				}
			}
			
		} 	
	}else
		System.out.println("NO");
	
	
}
static class Scanner 
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

	public String next() throws IOException 
	{
		while (st == null || !st.hasMoreTokens()) 
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {return Integer.parseInt(next());}
	
	public long nextLong() throws IOException {return Long.parseLong(next());}

	public String nextLine() throws IOException {return br.readLine();}
	
	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}
	
	public boolean ready() throws IOException {return br.ready();}


}





}
