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.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.InputStream;
import java.util.List;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.util.Collections;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ilyakor
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.nextInt();
        ArrayList<State> a = new ArrayList<>();
        for (int i = 0; i < n; ++i) {
            State s = new State(in.nextToken());
            if (s.failure()) {
                out.printLine("NO");
                return;
            }
            while (true) {
                int action = 1;
                for (int i1 = 0; i1 < a.size(); i1++) {
                    State other = a.get(i1);
                    if (s.intersects(other)) {
                        if (other.s.contains(s.s)) {
                            action = 0;
                        } else {
                            action = -1;
                            s = s.merge(other);
                            a.remove(i1);
                            break;
                        }
                    }
                }
                if (s == null || s.failure()) {
                    out.printLine("NO");
                    return;
                }
                if (action == 0) break;
                if (action == 1) {
                    a.add(s);
                    break;
                }
            }
        }
        ArrayList<String> res = new ArrayList<>();
        for (State s : a) res.add(s.s);
        Collections.sort(res);
        String rs = "";
        for (String part : res) rs += part;
        out.printLine(rs);
    }

    static class State {
        int[] cnts;
        String s;

        public State(String s) {
            this.s = s;
            cnts = new int[26];
            for (char c : s.toCharArray())
                cnts[c - 'a'] += 1;
        }

        boolean failure() {
            for (int x : cnts)
                if (x > 1) return true;
            return false;
        }

        boolean intersects(State other) {
            for (int i = 0; i < 26; ++i)
                if (cnts[i] > 0 && other.cnts[i] > 0) return true;
            return false;
        }

        State merge(State other) {
            if (s.contains(other.s))
                return new State(s);
            if (other.s.contains(s))
                return new State(other.s);
            for (int i = 0; i < s.length(); ++i) {
                String tmp = s.substring(0, i) + other.s;
                if (!tmp.startsWith(s)) continue;
                State st = new State(tmp);
                if (st.failure()) continue;
                return st;
            }
            for (int i = 0; i < other.s.length(); ++i) {
                String tmp = other.s.substring(0, i) + s;
                if (!tmp.startsWith(other.s)) continue;
                State st = new State(tmp);
                if (st.failure()) continue;
                return st;
            }
            return null;
        }
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public static boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
        if (count == -1) {
            throw new InputMismatchException();
        }
        try {
            if (cur >= count) {
                cur = 0;
                count = stream.read(buffer);
                if (count <= 0)
                    return -1;
            }
        } catch (IOException e) {
            throw new InputMismatchException();
        }
        return buffer[cur++];
    }

    public int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public String nextToken() {
        int c = readSkipSpace();
        StringBuilder sb = new StringBuilder();
        while (!isSpace(c)) {
            sb.append((char) c);
            c = read();
        }
        return sb.toString();
    }

    public int nextInt() {
        int sgn = 1;
        int c = readSkipSpace();
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res = res * 10 + c - '0';
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}

