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;
enum Value { White, Gray, Black };
vector<vector<int>> data(26, vector<int>(26));
vector<string> result;
vector<int> colors(26, White);
void DFS1(int v);
void DFS2(int v);
int main() {
  int n = 0;
  cin >> n;
  vector<bool> starts(26);
  for (int i = 0; i < n; i++) {
    string current;
    cin >> current;
    for (int j = 0; j < current.size() - 1; j++)
      data[current[j] - 'a'][current[j + 1] - 'a'] = 1;
    for (int j = 0; j < current.size(); j++) starts[current[j] - 'a'] = true;
  }
  for (int i = 0; i < colors.size(); i++)
    if (colors[i] == White) DFS1(i);
  for (int i = 0; i < data.size(); i++)
    for (int j = 0; j < data[i].size(); j++)
      if (data[i][j] == 1) starts[j] = false;
  for (int i = 0; i < starts.size(); i++) {
    if (starts[i]) {
      result.push_back(string());
      result.back().push_back((char)((int)'a' + i));
      DFS2(i);
    }
  }
  sort(result.begin(), result.end());
  if (result.empty()) {
    cout << "NO";
    return 0;
  }
  vector<int> check(26);
  for (int i = 0; i < result.size(); i++) {
    for (int j = 0; j < result[i].size(); j++) {
      check[result[i][j] - 'a']++;
      if (check[result[i][j] - 'a'] > 1) {
        cout << "NO";
        return 0;
      }
    }
  }
  for (int i = 0; i < result.size(); i++) cout << result[i];
  return 0;
}
void DFS1(int v) {
  if (colors[v] == Black) return;
  if (colors[v] == Gray) {
    cout << "NO";
    exit(0);
  }
  colors[v] = Gray;
  for (int j = 0; j < data[v].size(); j++)
    if (data[v][j] == 1) DFS1(j);
  colors[v] = Black;
}
void DFS2(int v) {
  int cnt = 0;
  for (int j = 0; j < data[v].size(); j++) {
    if (data[v][j] == 0) continue;
    if (cnt > 0) result.push_back(result.back());
    result.back().push_back((char)((int)'a' + j));
    DFS2(j);
    cnt++;
  }
}
