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

public class Main {
    static int get(char c) {
        return Character.getNumericValue(c) - Character.getNumericValue('a');
    }

    static void solve() throws IOException {
        int next[] = new int[26];
        int previous[] = new int[26];
        Arrays.fill(next, -1);
        Arrays.fill(previous, -1);
        boolean lonely[] = new boolean[26];
        int n = ni1();
        boolean exist = true;
        for (int i = 0; i < n; i++) {
            String s = input.readLine();
            int len = s.length();
            if (len == 1) {
                int u = get(s.charAt(0));
                if (next[u] == -1 && previous[u] == -1) lonely[u] = true;
                continue;
            }
            for (int j = 0; j < len - 1; j++) {
                int u = get(s.charAt(j));
                int v = get(s.charAt(j + 1));
                if (next[u] > -1 && next[u] != v) {
                    exist = false;
                    break;
                }
                if (previous[v] > -1 && previous[v] != u) {
                    exist = false;
                    break;
                }
                next[u] = v;
                previous[v] = u;
                lonely[u] = lonely[v] = false;
            }
            if (!exist) break;
        }


        if (exist) {
            boolean visited[] = new boolean[26];
            for (int i = 0; i < 26; i++) {
                if (previous[i] != -1) continue;
                if (visited[i]) continue;
                if (previous[i] == -1 && next[i] == -1) continue;
                int j = i;
                while (true) {
                    visited[j] = true;
                    if (next[j] == -1) break;
                    j = next[j];
                }
            }
            for (int i = 0; i < 26; i++) {
                if (next[i] != -1 && previous[i] != -1 && !visited[i]) {
                    exist = false;
                    break;
                }
            }
        }

        if (!exist) ans.append("NO\n");
        else {
            boolean visited[] = new boolean[26];
            ArrayList<String> list = new ArrayList<>();
            for (int i = 0; i < 26; i++) {
                if (previous[i] != -1) continue;
                if (visited[i]) continue;
                if (previous[i] == -1 && next[i] == -1) {
                    if (lonely[i]) list.add(Character.toString((char) (i + 97)));
                    continue;
                }
                int j = i;
                StringBuilder res = new StringBuilder();
                while (true) {
                    res.append((char) (j + 97));
                    visited[j] = true;
                    if (next[j] == -1) break;
                    j = next[j];
                }
                list.add(res.toString());
            }
            Collections.sort(list);
            int len = list.size();
            for (int i = 0; i < len; i++) ans.append(list.get(i));
            ans.append('\n');
        }
        output.write(ans.toString());
        output.flush();
        output.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().solve();
    }

    static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out));
    static StringBuilder ans = new StringBuilder();
    static String line;
    static StringTokenizer stringTokenizer;

    static int ni1() throws IOException {
        return Integer.parseInt(input.readLine());
    }

    static int ni2() throws IOException {
        return Integer.parseInt(stringTokenizer.nextToken());
    }

    static long nl1() throws IOException {
        return Long.parseLong(input.readLine());
    }

    static long nl2() {
        return Long.parseLong(stringTokenizer.nextToken());
    }

    static void rl() throws IOException {
        stringTokenizer = new StringTokenizer(input.readLine());
    }
}
