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

public class Question {
	public static int MOD = 1000000007;

	static Scan scn = new Scan();
	static Print printer = new Print();

	public static void main(String[] args) throws Exception {

		 String[] rv = solve2();
		
		 if (rv == null) {
		 printer.printLine("NO");
		 } else {
		printer.printLine("YES");
		 for (int i = 0; i < rv.length; i++) {
		 printer.printLine(rv[i] + "");
		 }
		 }

		printer.close();
	}

	public static void solve4() throws Exception {

		int[] arr = scn.inputArray(scn.scanInt());
		HashMap<Integer, Integer> hm = new HashMap<>();
		for (int i = 0; i < arr.length; i++) {
			hm.put(arr[i], i);
		}

		Arrays.sort(arr);
		int tmp = 0;
		int fd = 1, fa = arr[0];
		for (int diff = 2; diff <= 2 * (int) 1e5; diff++) {

			int idx = 0;
			while (idx < arr.length) {

				if (hm.containsKey(arr[idx] + diff)) {
					tmp = 2;
					idx = hm.get(arr[idx] + diff);
					break;
				}
				idx++;
			}

			while (idx < arr.length) {
				if (hm.containsKey(arr[idx] + diff)) {
					tmp++;
					idx = hm.get(arr[idx] + diff);

				} else {
					break;
				}
			}

			if (tmp > fa) {
				fa = tmp;
				fd = diff;
			}

		}

		if (fd == 1) {
			printer.printLine(fd + "");
			printer.printLine(fa + "");
		} else {

			int idx = 0;
			while (idx < arr.length) {
				if (hm.containsKey(arr[idx] + fd)) {
					break;
				}
				idx++;
			}

			printer.printLine(fd + "");
			while (idx < arr.length) {
				printer.print(arr[idx] + " ");

				if (hm.containsKey(arr[idx] + fd) == false)
					break;
				idx = hm.get(arr[idx] + fd);
			}
		}

	}

	public static void solve3() throws Exception {

		int k = scn.scanInt();
		ArrayList<Integer>[] lists = new ArrayList[k];
		HashSet<Integer>[] maps = new HashSet[k];
		int[] sums = new int[k];

		for (int i = 0; i < k; i++) {
			int n = scn.scanInt();
			ArrayList<Integer> list = new ArrayList<>();
			HashSet<Integer> hs = new HashSet<>();
			while (n-- > 0) {
				int tmp = scn.scanInt();
				list.add(tmp);
				hs.add(tmp);
				// sum[i] += tmp;
			}

		}

	}

	public static String[] solve2() throws Exception {
		int n = scn.scanInt();
		String[] arr = new String[n];
		for (int i = 0; i < arr.length; i++) {
			arr[i] = scn.scanString();
		}

		Arrays.sort(arr, new comp());

		for (int i = 0; i < arr.length - 1; i++) {
			if (arr[i].length() == arr[i + 1].length()) {
				if (arr[i].equals(arr[i + 1]) == false)
					return null;
				else
					continue;
			}

			if (!search(arr[i + 1], arr[i]))
				return null;
		}

		return arr;

	}

	public static boolean search(String txt, String pat) {
		int M = pat.length();
		int N = txt.length();

		for (int i = 0; i <= N - M; i++) {

			int j;

			for (j = 0; j < M; j++)
				if (txt.charAt(i + j) != pat.charAt(j))
					break;

			if (j == M) // if pat[0...M-1] = txt[i, i+1, ...i+M-1]
				return true;
		}

		return false;
	}

	public static class comp implements Comparator<String> {

		@Override
		public int compare(String o1, String o2) {
			// TODO Auto-generated method stub
			return o1.length() - o2.length();
		}

	}

	public static void solve1() throws Exception {

		HashMap<Integer, Integer> hm = new HashMap<>();
		int n = scn.scanInt();
		int k = scn.scanInt();
		int[] arr = scn.inputArray(n);

		for (int i = 0; i < arr.length; i++) {
			if (hm.containsKey(arr[i])) {

			} else {
				hm.put(arr[i], i);
			}
		}

		if (hm.size() < k) {
			printer.print("NO");
		} else {
			printer.printLine("YES");

			Set<Integer> keys = hm.keySet();

			for (int key : keys) {
				if (k <= 0)
					break;
				printer.print(hm.get(key) + 1 + " ");
				k--;
			}
		}
	}

	static class Scan {
		private InputStream in;
		private byte[] buf = new byte[1024 * 1024];
		private int index;
		private int total;

		public Scan() {
			// this.in = in;
			in = System.in;
			// try {
			// in = new FileInputStream(new File("/home/ujjwal/test/test"));
			// } catch (Exception ex) {
			//
			// }
		}

		public int scan() throws IOException {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				total = in.read(buf);
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public int[] inputArray(int n) throws Exception {
			int[] arr = new int[n];

			for (int i = 0; i < n; i++) {
				arr[i] = scn.scanInt();
			}

			return arr;
		}

		public ArrayList<Integer> inputList(int n) throws Exception {

			ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				list.add(scn.scanInt());
			}

			return list;
		}

		public int[][] inputMatrix(int n, int m) throws Exception {
			int[][] arr = new int[n][m];

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					arr[i][j] = scn.scanInt();
				}
			}

			return arr;
		}

		public int scanInt() throws IOException {
			int integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public long scanLong() throws IOException {
			long integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double scanDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public String scanString() throws IOException {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n)) {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}

	static class Print {
		private final BufferedWriter bw;

		public Print() {
			bw = new BufferedWriter(new OutputStreamWriter(System.out));
		}

		public void print(String str) throws IOException {
			bw.append(str);
		}

		public void printArray(int[] arr) throws Exception {

			for (int i = 0; i < arr.length; i++) {
				printer.print(arr[i] + " ");
			}

			printer.printLine("");
		}

		public void printList(ArrayList<Integer> list) throws Exception {

			for (int i = 0; i < list.size(); i++) {
				printer.print(list.get(i) + " ");
			}

			printer.printLine("");
		}

		public void printLine(String str) throws IOException {
			print(str);
			bw.append("\n");
		}

		public void close() throws IOException {
			bw.close();
		}
	}

}
