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.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
	
	private static int[] cnt = new int[200];
	private static String[] strs = new String[200];
	private static Map<Integer , Set<Integer>> graph = new HashMap<>();
	private static int[] inDegree = new int[200];
	
	private static boolean check(String string1 , String string2) {
		
		if (string2.contains(string1)) {
			return true;
		} else {
			return false;
		}
		
	}
	
	private static int solve(int n) {
		
		Map<String , Integer> map = new HashMap<>();
		for (int i = 0;i < n;i ++) {
			String string = strs[i];
			if (!map.containsKey(string)) {
				map.put(string , 1);
			} else {
				map.put(string , map.get(string) + 1);
			}
		}
		int next = 0;
		for (Map.Entry<String , Integer> entry : map.entrySet()) {
			strs[next] = entry.getKey();
			cnt[next] = entry.getValue();
			next ++;
		}
		return next;
		
	}
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);

		int i , j , n = scan.nextInt();
		for (i = 0;i < n;i ++) {
			strs[i] = scan.next();
		}
		n = solve(n);
		for (i = 0;i < n;i ++) {
			graph.put(i , new HashSet<>());
		}
		for (i = 0;i < n;i ++) {
			for (j = i + 1;j < n;j ++) {
				if (check(strs[i] , strs[j])) {
					graph.get(i).add(j);
					inDegree[j] ++;
				}
				if (check(strs[j] , strs[i])) {
					graph.get(j).add(i);
					inDegree[i] ++;
				}
			}
		}
		List<String> list = new ArrayList<>();
		Queue<Integer> queue = new LinkedList<>();
		for (i = 0;i < n;i ++) {
			if (inDegree[i] == 0) {
				queue.add(i);
			}
		}
		int temp = 0;
		while (!queue.isEmpty()) {
			if (queue.size() != 1) {
				break;
			}
			int current = queue.poll();
			temp ++;
			for (i = 0;i < cnt[current];i ++) {
				list.add(strs[current]);
			}
			for (int next : graph.get(current)) {
				inDegree[next] --;
				if (inDegree[next] == 0) {
					queue.add(next);
				}
			}
		}
		if (temp == n) {
			System.out.println("YES");
			for (String string : list) {
				System.out.println(string);
			}
		} else {
			System.out.println("NO");
		}
		
	}
    
}













