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>
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int N = 1100;
const int MAXN = int(1e6) + 100;
const int Mmask = (1 << 20);
const int mod = int(1e9) + 7;
const long long MOD = (long long)(1e18) + 7ll;
int solution();
int main(int argc, char* const argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  return solution();
}
bool debug = false;
int n;
string ans = "";
vector<string> strings;
void print() {
  if (!debug) return;
  cout << "Debug:\n";
  for (string s : strings) cout << s << ' ';
  cout << "\n\n";
}
bool str_cmp(string f, string s) {
  return (s[0] == f[0] && f.size() < s.size()) || (f[0] < s[0]);
}
bool checkBad(string x) {
  if (x.size() > 26) return true;
  vector<bool> u(26, 0);
  for (int i = 0; i < x.size(); i++) {
    if (u[x[i] - 'a']) return true;
    u[x[i] - 'a'] = true;
  }
  return false;
}
void get() {
  cin >> n;
  strings.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> strings[i];
    if (checkBad(strings[i])) {
      cout << "NO";
      exit(0);
    }
  }
}
bool preff(string f, string s) {
  for (int i = 0; i < f.size(); i++)
    if (f[i] != s[i]) return false;
  return true;
}
void remove_preffixes() {
  for (int i = 0; i < strings.size() - 1;) {
    if (strings[i][0] == strings[i + 1][0]) {
      if (preff(strings[i], strings[i + 1])) {
        strings.erase(begin(strings) + i);
      } else {
        cout << "NO";
        exit(0);
      }
    } else {
      i++;
    }
  }
}
bool can_join(string base, string add) {
  for (int i = 0; i < base.size(); i++) {
    if (base[i] == add[0]) {
      for (int j = 1; j < add.size() && i + j < base.size(); j++) {
        if (add[j] != base[i + j]) {
          cout << "NO";
          exit(0);
        }
      }
      return true;
    }
  }
  return false;
}
void join(string& base, string add) {
  for (int i = 0; i < base.size(); i++) {
    if (base[i] == add[0]) {
      for (int j = base.size() - i; j < add.size(); j++) base.push_back(add[j]);
      return;
    }
  }
}
void craft() {
  bool founded = true;
  while (founded) {
    founded = false;
    for (int i = 0; i < strings.size() && !founded; i++) {
      for (int j = 0; j < strings.size() && !founded; j++) {
        if (i == j) {
          continue;
        }
        if (can_join(strings[i], strings[j])) {
          join(strings[i], strings[j]);
          strings.erase(begin(strings) + j);
          founded = true;
        }
      }
    }
  }
}
void do_ans() {
  for (int i = 0; i < strings.size(); i++) {
    ans += strings[i];
  }
  if (debug) cout << "pre ans: " << ans << '\n';
  if (checkBad(ans)) {
    cout << "NO";
    exit(0);
  }
}
void print_ans() { cout << ans; }
int solution() {
  get();
  print();
  stable_sort(begin(strings), end(strings), str_cmp);
  if (debug) cout << "sorted:\n";
  print();
  remove_preffixes();
  if (debug) cout << "rem performed:\n";
  print();
  craft();
  if (debug) cout << "crafted:\n";
  print();
  do_ans();
  if (debug) cout << "strings appended:\n";
  print();
  print_ans();
  return 0;
}
