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;
void die() {
  cout << "NO";
  exit(0);
}
vector<long long> nxt(26, -1);
vector<long long> used(26, 0);
vector<vector<long long> > g(26);
vector<long long> inside(26, 0);
vector<long long> outside(26, 0);
long long cti(char a) { return a - 'a'; }
char itc(long long a) { return (char)(a + 97); }
void add(string &a) {
  for (long long i = 0; i < a.size(); ++i) used[cti(a[i])] = 1;
  for (long long i = 0; i < a.size() - 1; ++i) {
    if (a[i] == a[i + 1]) die();
    if (nxt[cti(a[i])] == -1) nxt[cti(a[i])] = cti(a[i + 1]);
    if (nxt[cti(a[i])] != cti(a[i + 1])) {
      die();
    }
  }
}
vector<string> saved(26, "");
void dfs(long long a, vector<long long> &curused, long long color) {
  if (inside[a] > 1 || outside[a] > 1) die();
  curused[a] = color;
  string tmp = "";
  tmp += itc(a);
  for (long long i = 0; i < g[a].size(); ++i) {
    long long b = g[a][i];
    if (curused[b] == color) {
      die();
    } else if (curused[b] != 0) {
    } else {
      dfs(b, curused, color);
    }
    tmp += saved[b];
  }
  saved[a] = tmp;
}
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (long long j = 0; j < s.size(); ++j) {
      add(s);
    }
  }
  for (long long i = 0; i < 26; ++i) {
    if (nxt[i] != -1) {
      g[i].push_back(nxt[i]);
      outside[i]++;
      inside[nxt[i]]++;
    }
  }
  vector<string> ans;
  vector<long long> c(26, 0);
  long long colid = 1;
  for (long long i = 0; i < 26; ++i) {
    if (used[i] && c[i] == 0) dfs(i, c, colid++);
  }
  vector<long long> srt;
  for (long long i = 0; i < 26; ++i) {
    if (!used[i]) continue;
    bool bad = false;
    for (long long j = 0; j < 26; ++j) {
      if (nxt[j] == i) bad = true;
    }
    if (!bad) ans.push_back(saved[i]);
  }
  sort(ans.begin(), ans.end());
  for (long long i = 0; i < ans.size(); ++i) {
    cout << ans[i];
  }
}
