A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.

You are given a set of strings. A string (not necessarily from this set) is called good if all elements of the set are the most frequent substrings of this string. Restore the non-empty good string with minimum length. If several such strings exist, restore lexicographically minimum string. If there are no good strings, print "NO" (without quotes).

A substring of a string is a contiguous subsequence of letters in the string. For example, "ab", "c", "abc" are substrings of string "abc", while "ac" is not a substring of that string.

The number of occurrences of a substring in a string is the number of starting positions in the string where the substring occurs. These occurrences could overlap.

String a is lexicographically smaller than string b, if a is a prefix of b, or a has a smaller letter at the first position where a and b differ.

Input

The first line contains integer n (1 ≤ n ≤ 105) — the number of strings in the set.

Each of the next n lines contains a non-empty string consisting of lowercase English letters. It is guaranteed that the strings are distinct.

The total length of the strings doesn't exceed 105.

Output

Print the non-empty good string with minimum length. If several good strings exist, print lexicographically minimum among them. Print "NO" (without quotes) if there are no good strings.

Examples

Input

4
mail
ai
lru
cf


Output

cfmailru


Input

3
kek
preceq
cheburek


Output

NO

Note

One can show that in the first sample only two good strings with minimum length exist: "cfmailru" and "mailrucf". The first string is lexicographically minimum.
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class B {

	

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		
		TreeSet<String> S = new TreeSet<>();
		
		for (int i = 0; i < n; i++) {
			String cur = sc.next();
			if(cur.length() > 26) {
				out.println("NO");
				out.flush();
				return;
			}
			
			int[] cnt = new int[26];
			
			for (int j = 0; j < cur.length(); j++) {
				cnt[cur.charAt(j) - 'a']++;
				if(cnt[cur.charAt(j) - 'a'] > 1) {
					out.println("NO");
					out.flush();
					return;
				}
			}
			
			S.add(cur);
		}
		
		int[] nxt = new int[26];
		Arrays.fill(nxt, -1);
		boolean[] pres = new boolean[26];
		boolean[] isroot = new boolean[26];
		Arrays.fill(isroot, true);
		for (String s : S) {
			for (int i = 0; i < s.length(); i++) {
				pres[s.charAt(i) - 'a'] = true;
			}
			
			for (int i = 0; i < s.length() - 1; i++) {
				if(nxt[s.charAt(i) - 'a'] != -1 && nxt[s.charAt(i) - 'a'] != s.charAt(i + 1) - 'a') {
					out.println("NO");
					out.flush();
					return;
				}
				nxt[s.charAt(i) - 'a'] = s.charAt(i + 1) - 'a';
				isroot[s.charAt(i + 1) - 'a'] = false;
				
			}
		}
		ArrayList<Character> ans = new ArrayList<>();
		int cnt = 0;
		for (int i = 0; i < 26; i++) {
			if(pres[i] && isroot[i]) {
				
				int c = i;
			
				while(c != -1) {
				    	if(ans.contains((char) (c + 'a'))) {
					out.println("NO");
					out.flush();
					return;
				}
					ans.add((char) (c + 'a'));
					c = nxt[c];
				}
			}
			if(pres[i])
				cnt++;
		}
		
		if(cnt != ans.size()) {
			out.println("NO");
			out.flush();
			return;
		}else{
			for(char c : ans)
				out.print(c);
			out.println();
		}

		out.flush();
		out.close();
	}


	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException{	br = new BufferedReader(new FileReader(file));}


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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}

		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);
		}

	}

}