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.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;

public class Main {
    private FastScanner in;
    private PrintWriter out;

    private void solve() throws IOException {
        int n = in.nextInt();

        char[][] c = new char[n][];
        for (int i = 0; i < n; i++)
            c[i] = in.nextLine().toCharArray();

        for (int i = 0; i < n; i++)
            for (int j = 0; j < c[i].length; j++)
                c[i][j] -= 'a';

        int alpha = 'z' + 1 - 'a';

        boolean[] have = new boolean[alpha];
        for (int i = 0; i < n; i++)
            for (int j = 0; j < c[i].length; j++)
                have[c[i][j]] = true;

        int[] next = new int[alpha];
        fill(next, -1);

        for (int i = 0; i < n; i++)
            for (int j = 0; j + 1 < c[i].length; j++)
                if (next[c[i][j]] == -1)
                    next[c[i][j]] = c[i][j + 1];

                else if (next[c[i][j]] != c[i][j + 1]) {
                    out.print("NO");
                    return;
                }

        boolean[] begin = new boolean[alpha];
        fill(begin, true);

        for (int i = 0; i < alpha; i++)
            if (next[i] != -1)
                begin[next[i]] = false;

        StringBuilder ans = new StringBuilder();

        boolean[] used = new boolean[alpha];
        for (int i = 0; i < alpha; i++)
            if (have[i] && !used[i] && begin[i])
                for (int j = i; j != -1; j = next[j]) {

                    if (used[j]) {
                        out.print("NO");
                        return;
                    }

                    ans.append((char) (j + 'a'));
                    used[j] = true;
                }

        for (int i = 0; i < alpha; i++)
            if (have[i] && !used[i]) {
                out.print("NO");
                return;
            }

        out.print(ans.toString());
    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

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

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

    }

    private void run() throws IOException {
        in = new FastScanner(System.in);
        // in = new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out);
        // out = new PrintWriter(new FileOutputStream(".out"));

        solve();

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

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