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 INF = 2147483647;
const long long INFL = 9223372036854775807LL;
const double EPSILON = 0.00000001;
const long long MOD = 1000000007;
bool used[26];
int next_char[26];
bool follows[26];
bool init_check(string s) {
  memset(used, false, sizeof(used));
  ;
  for (int i = 0; i < s.length(); i++) {
    if (used[s[i] - 'a']) {
      return false;
    }
    used[s[i] - 'a'] = true;
  }
  return true;
}
bool check(string ans, vector<string>& strs) {
  for (int i = 0; i < (int)(strs).size(); i++) {
    if (ans.find(strs[i]) == string::npos) return false;
  }
  return true;
}
int32_t main() {
  int n;
  cin >> n;
  vector<string> strs;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    strs.push_back(s);
    if (not init_check(s)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  memset(next_char, -1, sizeof(next_char));
  ;
  memset(follows, false, sizeof(follows));
  ;
  memset(used, false, sizeof(used));
  ;
  for (int i = 0; i < n; i++) {
    used[strs[i][0] - 'a'] = true;
    for (int j = 0; j < strs[i].length() - 1; j++) {
      int c = strs[i][j] - 'a';
      int c2 = strs[i][j + 1] - 'a';
      used[c] = used[c2] = true;
      if (next_char[c] != -1 and next_char[c] != c2) {
        cout << "NO" << endl;
        return 0;
      }
      next_char[c] = c2;
      follows[c2] = true;
    }
  }
  vector<int> starts;
  for (int i = 0; i < 26; i++) {
    if (used[i] and not follows[i]) {
      starts.push_back(i);
    }
  }
  if ((int)(starts).size() == 0) {
    cout << "NO" << endl;
    return 0;
  };
  memset(used, false, sizeof(used));
  ;
  vector<string> ans_strs;
  for (auto it = starts.begin(); it != starts.end(); it++) {
    string cur_str = "";
    cur_str += 'a' + (*it);
    used[*it] = true;
    int cur = *it;
    while (next_char[cur] != -1) {
      cur = next_char[cur];
      if (used[cur]) {
        cout << "NO" << endl;
        return 0;
      }
      used[cur] = true;
      cur_str += 'a' + cur;
    }
    ans_strs.push_back(cur_str);
  }
  sort(ans_strs.begin(), ans_strs.end());
  string ans = "";
  for (int i = 0; i < (int)(ans_strs).size(); i++) {
    ans += ans_strs[i];
  }
  if (check(ans, strs))
    cout << ans << endl;
  else
    cout << "NO" << endl;
  return 0;
}
