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;
deque<string> strings;
bool logger = false;
void print() {
  if (!logger) return;
  cout << "logger:\n";
  for (string s : strings) cout << s << ' ';
  cout << '\n';
}
bool myStrComp(string s1, string s2) {
  if (s1[0] == s2[0])
    return s1.length() < s2.length();
  else
    return s1[0] < s2[0];
}
bool nicePair(string &s1, string &s2) {
  int steps = min(s1.length(), s2.length());
  for (int i = 0; i < steps; i++)
    if (s1[i] != s2[i]) return false;
  return true;
}
bool repeatableLetters(string s) {
  if (s.size() > 26) return true;
  vector<bool> present(26);
  for (char c : s)
    if (present[c - 'a'])
      return true;
    else
      present[c - 'a'] = true;
  return false;
}
bool joinable(string &str, string &join) {
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == join[0]) {
      for (int j = i + 1; j < str.size() && j - i < join.size(); j++) {
        if (str[j] != join[j - i]) return false;
      }
      return true;
    }
  }
  return false;
}
void join(string &str, string &join) {
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == join[0]) {
      for (int j = i + 1; j - i < join.size(); j++) {
        if (j >= str.size()) str.push_back(join[j - i]);
      }
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  strings.resize(n);
  for (int i = 0; i < n; i++) cin >> strings[i];
  stable_sort(strings.begin(), strings.end(), myStrComp);
  print();
  for (int i = 0; i < strings.size() - 1;) {
    if (strings[i][0] == strings[i + 1][0]) {
      if (nicePair(strings[i], strings[i + 1])) {
        if (strings[i].length() > strings[i + 1].length()) {
          strings.erase(strings.begin() + i + 1);
        } else {
          strings.erase(strings.begin() + i);
        }
      } else {
        cout << "NO";
        return 0;
      }
    } else {
      i++;
    }
  }
  print();
  bool joined = true;
  while (joined) {
    joined = false;
    for (int i = 0; i < strings.size() && !joined; i++) {
      for (int j = i + 1; j < strings.size() && !joined; j++) {
        if (joinable(strings[i], strings[j])) {
          join(strings[i], strings[j]);
          joined = true;
          strings.erase(strings.begin() + j);
          print();
        } else if (joinable(strings[j], strings[i])) {
          join(strings[j], strings[i]);
          joined = true;
          strings.erase(strings.begin() + i);
          print();
        }
      }
    }
  }
  print();
  string result = "";
  for (int i = 0; i < strings.size(); i++) {
    result.append(strings[i]);
  }
  if (repeatableLetters(result)) {
    cout << "NO";
  } else {
    cout << result;
  }
  return 0;
}
