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 + 100;
int N, M;
string s[maxn];
bool vis[maxn];
int p[maxn];
bool check_more(const string &t) {
  static int g[30];
  memset(g, 0, sizeof(g));
  for (int i = (0), _i = (t.size() - 1); i <= _i; ++i) {
    int w = t[i] - 'a';
    if (g[w]) return 1;
    ++g[w];
  }
  return 0;
}
void solve() {
  static int g[30];
  static vector<int> f[30];
  memset(g, 0, sizeof(g));
  for (int i = (0), _i = (26); i <= _i; ++i) f[i].clear();
  for (int i = (1), _i = (M); i <= _i; ++i) {
    for (int j = (0), _j = (s[i].size() - 1); j <= _j; ++j) ++g[s[i][j] - 'a'];
    f[s[i][0] - 'a'].push_back(i);
  }
  for (int i = (0), _i = (25); i <= _i; ++i)
    if (f[i].size() > 1) {
      printf("NO\n");
      return;
    }
  for (int i = (0), _i = (M); i <= _i; ++i) vis[i] = 0;
  string ans = "";
  bool flag = 0;
  for (int i = (0), _i = (25); i <= _i; ++i)
    if (g[i] == 1 && f[i].size() == 1 && !vis[f[i][0]]) {
      int j = ans.size();
      ans += s[f[i][0]];
      vis[f[i][0]] = 1;
      flag = 1;
      int len = ans.size();
      for (; j < ans.size(); ++j) {
        int w = ans[j] - 'a';
        if (f[w].size() == 1 && !vis[f[w][0]]) {
          int k = f[w][0];
          int jj = j;
          for (int t = (0), _t = (s[k].size() - 1); t <= _t; ++t) {
            if (jj == ans.size())
              ans += s[k][t];
            else if (ans[jj] != s[k][t]) {
              printf("NO\n");
              return;
            }
            ++jj;
          }
          vis[k] = 1;
        }
      }
    }
  for (int i = (1), _i = (M); i <= _i; ++i)
    if (!vis[i]) {
      printf("NO\n");
      return;
    }
  memset(g, 0, sizeof(g));
  for (int i = (0), _i = (ans.size() - 1); i <= _i; ++i) ++g[ans[i] - 'a'];
  for (int i = (0), _i = (25); i <= _i; ++i)
    if (g[i] > 1) {
      printf("NO\n");
      return;
    }
  cout << ans << endl;
}
void Done() {
  for (int i = (1), _i = (N); i <= _i; ++i)
    if (s[i].size() > 26) {
      printf("NO\n");
      return;
    }
  for (int i = (1), _i = (N); i <= _i; ++i)
    if (check_more(s[i])) {
      printf("NO\n");
      return;
    }
  int len = 0;
  for (int i = (1), _i = (N); i <= _i; ++i) len += s[i].size();
  if (len > 4000) {
    printf("NO\n");
    return;
  }
  for (int i = (0), _i = (N); i <= _i; ++i) vis[i] = 0;
  for (int i = (1), _i = (N); i <= _i; ++i)
    for (int j = (1), _j = (N); j <= _j; ++j)
      if (i != j && s[j].find(s[i]) != -1) {
        vis[i] = 1;
        break;
      }
  M = 0;
  for (int i = (1), _i = (N); i <= _i; ++i)
    if (!vis[i]) p[++M] = i;
  sort(p + 1, p + M + 1);
  for (int i = (1), _i = (M); i <= _i; ++i) s[i] = s[p[i]];
  solve();
}
int main() {
  int ans = 0;
  int a = 26, b = 1;
  for (int i = (1), _i = (26); i <= _i; ++i) {
    ans += a * b;
    --a;
    ++b;
  }
  for (; scanf("%d", &N) != EOF;) {
    for (int i = (1), _i = (N); i <= _i; ++i) cin >> s[i];
    Done();
  }
  return 0;
}
