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;
mt19937 rnd(1337);
ostream& operator<<(ostream& a, const pair<long long, long long>& b) {
  cout << "{" << b.first << ", " << b.second << "}";
  return a;
}
ostream& operator<<(ostream& a, const vector<long long int>& b) {
  for (auto& k : b) cout << k << " ";
  return a;
}
ostream& operator<<(ostream& a, const vector<pair<long long, long long> >& b) {
  for (auto& k : b) cout << k << " ";
  return a;
}
const long long int INF = (long long int)1e18;
const long long int MOD = 1000 * 1000 * 1000 + 7, MOD2 = 274876858367;
const long long int maxn = (long long int)1e5 + 10, L = 22;
long long int gr[26][26];
bool used[26], kek[26];
long long int deg[26];
string ans;
bool ok = 1;
void dfs(long long int u) {
  if (!ok) return;
  ans += u + 'a';
  used[u] = 1;
  for (long long int i = 0; i < 26; ++i) {
    if (!gr[u][i]) continue;
    if (used[i]) ok = 0;
    dfs(i);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (auto x : s) kek[x - 'a'] = 1;
    for (long long int i = 1; i < s.size(); ++i) {
      ++deg[s[i] - 'a'];
      gr[s[i - 1] - 'a'][s[i] - 'a'] = 1;
    }
  }
  for (long long int i = 0; i < 26; ++i) {
    long long int now = 0;
    for (long long int j = 0; j < 26; ++j) now += gr[i][j];
    if (now > 1) return cout << "NO\n", 0;
  }
  for (long long int i = 0; i < 26; ++i) {
    if (!deg[i] && !used[i] && kek[i]) dfs(i);
  }
  for (long long int i = 0; i < 26; ++i) {
    if (deg[i] && !used[i]) ok = 0;
  }
  if (!ok) return cout << "NO\n", 0;
  cout << ans;
  return 0;
}
