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;
vector<int> str[26];
string s[100100];
int p[100100], h[100100];
int find_set(int v) { return p[v] == v ? v : p[v] = find_set(p[v]); }
string union_str(string a, string b, char c) {
  int p1 = find(begin(a), end(a), c) - begin(a);
  int p2 = find(begin(b), end(b), c) - begin(b);
  if (p1 < p2) {
    swap(p1, p2);
    swap(a, b);
  }
  for (int i(p1 - p2); i < min(a.size(), b.size() + p1 - p2); ++i)
    if (a[i] != b[i - p1 + p2]) return string("NO");
  for (int i(0); i < p1 - p2; ++i) b = ' ' + b;
  for (int i(a.size()); i < b.size(); ++i) a += b[i];
  bool was[26] = {};
  for (char c : a)
    if (was[c - 'a'])
      return string("NO");
    else
      was[c - 'a'] = true;
  return a;
}
bool ok(true);
void union_set(int u, int v, char c) {
  u = find_set(u);
  v = find_set(v);
  if (u == v) return;
  if (h[u] < h[v]) swap(u, v);
  p[v] = u;
  h[u] += h[u] == h[v];
  s[u] = union_str(s[u], s[v], c);
  ok &= s[u] != "NO";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i(0); i < n; ++i) {
    bool was[26] = {};
    cin >> s[i];
    p[i] = i;
    for (char c : s[i]) {
      if (was[c - 'a']) {
        cout << "NO";
        return 0;
      }
      was[c - 'a'] = true;
      str[c - 'a'].push_back(i);
    }
  }
  for (char c(0); c < 26 and ok; ++c)
    for (int u : str[c]) union_set(u, str[c].front(), c + 'a');
  if (!ok) {
    cout << "NO";
    return 0;
  }
  set<string> ans;
  for (int i(0); i < n; ++i) ans.insert(s[find_set(i)]);
  for (string t : ans) cout << t;
}
