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 = 1e5 + 69;
long long B = 237;
long long M = 1e9 + 7;
bool used[MAXN];
string a[MAXN];
vector<pair<int, int>> cnt[30];
int cn[200][30];
int kek[30];
unordered_map<long long, int> q;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) {
    if (a[i].size() > 26) {
      cout << "NO";
      return 0;
    }
    int d = a[i].size();
    for (int j = 0; j < d; ++j) {
      long long h = 0;
      for (int k = j; k < d; ++k) {
        h = (h * B) % M + a[i][k] - 'a' + 1;
        if (j == 0 && k == d - 1) continue;
        q[h]++;
      }
    }
  }
  vector<string> b;
  for (int i = 0; i < n; ++i) {
    long long h = 0;
    for (int k = 0; k < a[i].size(); ++k) {
      h = (h * B) % M + a[i][k] - 'a' + 1;
    }
    if (!q[h]) b.push_back(a[i]);
  }
  vector<string> cc = b;
  n = b.size();
  if (n > 53) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < b[i].size(); ++j) {
      int c = b[i][j] - 'a';
      cnt[c].push_back({i, j});
      cn[i][c]++;
      kek[c]++;
    }
  }
  while (1) {
    n = b.size();
    bool ok = 0;
    for (int i = 0; (i < n) && !ok; ++i)
      for (int j = 0; j < n && !ok; ++j) {
        if (i == j) continue;
        int j1 = 0;
        while (b[j].find(b[i][j1], j1) != std::string::npos) {
          kek[b[i][j1] - 'a']--;
          j1++;
          ok = 1;
        }
        if (ok) {
          b[i] = b[j] + b[i].substr(j1, b[i].size());
          b.erase(b.begin() + j);
        }
      }
    if (!ok) break;
  }
  sort(b.begin(), b.end());
  for (int i = 0; i < 27; ++i)
    if (kek[i] > 1) {
      cout << "NO";
      return 0;
    }
  string z = "";
  for (auto i : b) z += i;
  for (auto i : cc)
    if (z.find(i) == std::string::npos) {
      cout << "NO";
      return 0;
    }
  for (auto i : b) cout << i;
  return 0;
}
