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.
#include <bits/stdc++.h>
using namespace std;
const int N = 100002;
int n;
string a[N];
bool mark[32];
void cleanm() {
  for (int i = (0); i < (26); ++(i)) mark[i] = false;
}
set<string> st;
set<string>::iterator it1, it2;
bool hmm(const string &a, const string &b) {
  for (int i = (0); i < (((int)a.size())); ++(i)) {
    for (int j = (0); j < (((int)b.size())); ++(j)) {
      if (a[i] == b[j]) return true;
    }
  }
  return false;
}
string CONC(const string &a, const string &b) {
  int bg = -1;
  for (int i = (0); i < (((int)a.size())); ++(i)) {
    if (a[i] == b[0]) {
      bg = i;
      break;
    }
  }
  if (bg == -1) return "";
  string result = "";
  for (int i = (0); i < (bg); ++(i)) {
    result += a[i];
  }
  int j = bg;
  for (int i = (0); i < (((int)b.size())); ++(i)) {
    if (j < ((int)a.size()) && a[j] != b[i]) return "";
    result += b[i];
    ++j;
  }
  for (j = j; j < ((int)a.size()); ++j) result += a[j];
  cleanm();
  for (int i = (0); i < (((int)result.size())); ++(i)) {
    if (mark[result[i] - 'a'])
      return "";
    else
      mark[result[i] - 'a'] = true;
  }
  return result;
}
int main() {
  scanf("%d", &n);
  int sm = 0;
  bool vata = false;
  for (int i = (0); i < (n); ++(i)) {
    a[i] = "";
    char z;
    if (i == 0) scanf("%c", &z);
    while (scanf("%c", &z)) {
      if (z == '\n') break;
      a[i] += z;
    }
    cleanm();
    for (int j = (0); j < (((int)a[i].size())); ++(j)) {
      if (mark[a[i][j] - 'a']) {
        vata = true;
      } else
        mark[a[i][j] - 'a'] = true;
    }
    st.insert(a[i]);
  }
  if (vata) {
    cout << "NO" << endl;
    return 0;
  }
  n = ((int)st.size());
  for (int i = (0); i < (n); ++(i)) {
    bool found = false;
    for (it1 = st.begin(); it1 != st.end(); ++it1) {
      if (found) break;
      for (it2 = st.begin(); it2 != st.end(); ++it2) {
        if (found) break;
        if (it1 != it2) {
          string s1 = (*it1);
          string s2 = (*it2);
          if (hmm(s1, s2)) {
            string p = CONC(s1, s2);
            string q = CONC(s2, s1);
            if (p != "") {
              st.erase(s1);
              st.erase(s2);
              st.insert(p);
            } else if (q != "") {
              st.erase(s1);
              st.erase(s2);
              st.insert(q);
            } else {
              cout << "NO" << endl;
              return 0;
            }
            found = true;
            break;
          }
        }
      }
      if (found) break;
    }
  }
  for (it1 = st.begin(); it1 != st.end(); ++it1) cout << (*it1);
  cout << endl;
  return 0;
}
