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 MAXN = 100000 + 10;
string str[MAXN];
int isv[400];
set<string> se;
bool isok(string s) {
  if (s.size() > 26) return false;
  int alp[26];
  memset(alp, 0x00, sizeof(alp));
  for (int i = 0; i < s.size(); ++i) {
    if (alp[s[i] - 'a']) return false;
    alp[s[i] - 'a'] = 1;
  }
  return true;
}
int solve(string s1, string s2) {
  if (s1.find(s2) != std::string::npos) return 1;
  if (s2.find(s1) != std::string::npos) return 2;
  set<char> ch;
  for (int i = 0; i < s1.size(); ++i) ch.insert(s1[i]);
  for (int i = 0; i < s2.size(); ++i) ch.insert(s2[i]);
  int len = s1.size() + s2.size() - ch.size();
  if (!len) return 3;
  int i1, i2;
  string sss;
  i1 = s1.size() - len;
  i2 = 0;
  sss = s1.substr(0, s1.size() - len);
  while (i1 < s1.size() && s1[i1] == s2[i2]) ++i1, ++i2;
  if (i1 == s1.size()) {
    se.insert(sss + s2);
    return 4;
  }
  i1 = 0;
  i2 = s2.size() - len;
  sss = s2.substr(0, s2.size() - len);
  while (i2 < s2.size() && s1[i1] == s2[i2]) ++i1, ++i2;
  if (i2 == s2.size()) {
    se.insert(sss + s1);
    return 4;
  }
  return 5;
}
int main(void) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n > 27 * 13) {
    cout << "NO";
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    cin >> str[i];
    if (!isok(str[i])) {
      cout << "NO";
      return 0;
    }
  }
  int top = n;
  while (true) {
    memset(isv, 0x00, sizeof(isv));
    for (int i = 1; i <= top; ++i) {
      if (isv[i]) continue;
      for (int j = i + 1; j <= top; ++j) {
        if (isv[j]) continue;
        int c = solve(str[i], str[j]);
        if (c == 1)
          isv[j] = 1;
        else if (c == 2)
          isv[i] = 1;
        else if (c == 4)
          isv[i] = isv[j] = 1;
        else if (c == 5) {
          cout << "NO";
          return 0;
        }
        if (isv[i] == 1) break;
      }
    }
    if (se.empty()) break;
    int to = 0;
    for (int i = 1; i <= top; ++i) {
      if (!isv[i]) str[++to] = str[i];
    }
    set<string>::iterator it;
    for (it = se.begin(); it != se.end(); ++it) str[++to] = *it;
    se.clear();
    top = to;
  }
  for (int i = 1; i <= top; ++i) {
    if (!isv[i]) se.insert(str[i]);
  }
  set<string>::iterator it;
  for (it = se.begin(); it != se.end(); ++it) cout << (*it);
}
