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.util.*;
import java.io.*;

public class q1 {
	 

		private static InputStream stream;
		private static byte[] buf = new byte[1024];
		private static int curChar;
		private static int numChars;
		private static SpaceCharFilter filter;
		private static PrintWriter pw;
		private static long mod = 1000000000 + 7;
		private static int MAX=1000001;
		private static int block;
		
		
		private static void soln(){
		int n=nextInt();
		String[] arr=new String[n];
		HashMap<Integer,ArrayList<String>> map=new HashMap<Integer,ArrayList<String>>();
		String small="";
		int length=0;
		for(int i=0;i<n;i++) {
			arr[i]=nextLine();
			if(arr[i].length()<length) {
				length=arr[i].length();
				small=arr[i];
				
			}
			if(map.containsKey(arr[i].length())) {
				ArrayList<String> temp=map.get(arr[i].length());
				temp.add(arr[i]);
				map.put(arr[i].length(), temp);
			}else {
				ArrayList<String> t=new ArrayList<String>();
			t.add(arr[i]);
			map.put(arr[i].length(),t);
			}
			
		}
		
		ArrayList<String> strings=new ArrayList<String>();
		for(int i=0;i<n;i++) {
			strings.add(arr[i]);
		}
		q1 c=new q1();
		
		for(int i=0;i<n;i++) {
			for(int j=i+1;j<n;j++) {
				if(arr[i].length()>arr[j].length()) {
					String temp=arr[i];
					arr[i]=arr[j];
					arr[j]=temp;
				}
			}
		}	
		
		for(int i=0;i<n;i++) {
			for(int j=i;j<n;j++) {
				if(!arr[j].contains(arr[i])) {
					System.out.println("NO");
					return;
				}
			}
		}
		System.out.println("YES");
		
		for(int i=0;i<n;i++) {
			System.out.println(arr[i]);
		}
		  
		    
        
        
				
		}
		
		public static boolean fun(int n,int[] arr,long x){
		   
		    long sum=0;
		    for(int i=0;i<n;i++){
		        sum+=arr[i];
		    }
		    if(sum>x){
		        return false;
		    }
		    for(int i=n;i<arr.length;i++){
		        sum=sum-arr[i-n];
		        sum=sum+arr[i];
		        if(sum>x){
		            return false;
		        }
		       
		    }
		    
		    return true;
		}
		
		public static void main(String[] args) throws Exception {
			new Thread(null,new Runnable(){
				@Override
				public void run() {
					
					InputReader(System.in);
					pw = new PrintWriter(System.out);
					
					soln();
					pw.close();
				}
			},"1",1<<26).start();
		}
	
		public static void InputReader(InputStream stream1) {
			stream = stream1;
		}
		private static int upperBound(int[] arr,int x) {
	        int l = 0, r =arr.length;
	        while (l < r) {
	            int m = (l + r) >> 1;
	            if (arr[m] <= x) l = m + 1;
	            else r = m;
	        }
	        return l;
	    }
	 
	    private static int lowestBound(int[] arr,int x) {
	        int l = 0, r = arr.length;
	        while (l < r) {
	            int m = (l + r) >> 1;
	            if (arr[m] < x) l = m + 1;
	            else r = m;
	        }
	        return l;
	    }
		static int GreEq(int[] arr,int x) {
			int low=0;
 
			int ans=-1;
			int high=arr.length-1;
			while(low<=high) {
				int mid=(low+high)/2;
				if(arr[mid]>=x) {
					ans=mid;
					high=mid-1;
				}else {
					low=mid+1;
				}
			}
			if(ans!= -1)
			return arr.length-ans;
			else
				return 0;
		}
		static int Gre(int[] arr,int x) {
			int low=0;
			int ans=-1;
			int high=arr.length-1;
			while(low<=high) {
				int mid=(high+low)/2;
				if(arr[mid]>x) {
					ans=mid;
					high=mid-1;
				}else {
					low=mid+1;
				}
			}
			if(ans!=-1)
			return arr.length-ans;
			else
				return 0;
		}
	
		private static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	
		private static boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	
		private static int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
	
		private static int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		private static long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		private static String nextToken() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
	
		private static String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
	
		private static int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}
	
		private static long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}
	
		private static void pArray(int[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			return;
		}
	
		private static void pArray(long[] arr) {
			for (int i = 0; i < arr.length; i++) {
				System.out.print(arr[i] + " ");
			}
			System.out.println();
			return;
		}
	
		private static boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return isWhitespace(c);
		}
		private static char nextChar() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			char c1=(char)c;
			while(!isSpaceChar(c))
				c=read();
			return c1;
	}
		private interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

