#include <bits/stdc++.h>   using namespace std;   char string_in_buffer[(int)2e5];   void fast_scan(int &first) { scanf( %d , &first); }   void fast_scan(long long &first) { scanf( %lld , &first); }   void fast_scan(unsigned long long &first) { scanf( %llu , &first); }   void fast_scan(double &first) { scanf( %lf , &first); }   void fast_scan(long double &first) { scanf( %Lf , &first); }   void fast_scan(char &first) {     scanf( %c , &first);     if (first ==   n ) {       fast_scan(first);     }   }   void fast_scan(string &first) {     scanf( %s , string_in_buffer);     first = string(string_in_buffer);   }   template <class TFirst, class TSecond>   void fast_scan(pair<TFirst, TSecond> &p) {     fast_scan(p.first);     fast_scan(p.second);   }   template <class T>   void fast_scan(vector<T> &v) {     for (auto &first : v) fast_scan(first);   }   void fast_print(const int &first) { printf( %d , first); }   void fast_print(const long long &first) { printf( %lld , first); }   void fast_print(const unsigned long long &first) { printf( %llu , first); }   void fast_print(const double &first) { printf( %.15lf , first); }   void fast_print(const long double &first) { printf( %.15Lf , first); }   void fast_print(const char &first) { printf( %c , first); };   void fast_print(const string &first) { printf( %s , first.c_str()); }   template <class TFirst, class TSecond>   void fast_print(const pair<TFirst, TSecond> &p) {     fast_print(p.first);     fast_print(   );     fast_print(p.second);   }   template <class T>   void fast_print(const vector<T> &v) {     if (v.empty()) return;     fast_print(v[0]);     for (int i = 1; i < v.size(); i++) {       fast_print(   );       fast_print(v[i]);     }   }   template <class T>   void fast_print(const vector<vector<T>> &v) {     if (v.empty()) return;     fast_print(v[0]);     for (int i = 1; i < v.size(); i++) {       fast_print(  n );       fast_print(v[i]);     }   }   using namespace std;   namespace smart_io {   string print_start =   ;   string sep =    ;   bool first_print = false;   void precall_print() {     fast_print(print_start);     print_start =   n ;     first_print = true;   }   }  // namespace smart_io   template <class T>   ostream &operator,(ostream &os, const T &object) {     if (!smart_io::first_print) {       fast_print(smart_io::sep);     } else {       smart_io::first_print = false;     }     fast_print(object);     return os;   }   template <class T>   istream &operator,(istream &is, T &object) {     fast_scan(object);     return is;   }   namespace typedefs {}   namespace numbers_operation {   template <class T>   T floor_mod(T a, T b) {     if (a % b == 0) return 0;     if (a >= 0 && b >= 0) return a % b;     if (a <= 0 && b <= 0) return a % b;     return abs(b) - (abs(a) % abs(b));   }   }  // namespace numbers_operation   using namespace numbers_operation;   using namespace typedefs;   int n;   vector<string> v;   bool expand(string &base, int i, string t) {     for (int j = 0; j < ((int)t.size()); j++) {       if (j + i >= ((int)base.size())) {         base += t[j];       } else {         if (base[j + i] != t[j]) {           return false;         }       }     }     return true;   }   signed main(signed argc, char *argv[]) {     {       cin, n;       v.resize(n);       cin, v;     }     {       for (string s : v) {         if (((int)set<char>(s.begin(), s.end()).size()) != ((int)s.size())) {           smart_io::precall_print();           cout,  NO ;           return 0;         }       }     }     {       while (true) {         vector<int> not_first_vec(26);         vector<int> cnt(26);         for (int i = 0; i < n; i++) {           vector<int> local(26);           for (int j = 0; j < ((int)v[i].size()); j++) {             local[v[i][j] -  a ]++;           }           for (int j = 0; j < 26; j++) {             if (local[j] > 1) {               smart_io::precall_print();               cout,  NO ;               return 0;             }           }           cnt[v[i][0] -  a ]++;           for (int j = 1; j < ((int)v[i].size()); j++) {             not_first_vec[v[i][j] -  a ]++;             cnt[v[i][j] -  a ]++;           }         }         char c =  ! ;         for (int i = 0; i < 26; i++) {           if (not_first_vec[i] <= 1 && cnt[i] > 1) {             c = i +  a ;           }         }         if (c ==  ! ) break;         vector<pair<int, int>> where;         for (int i = 0; i < n; i++) {           for (int j = 0; j < ((int)v[i].size()); j++) {             if (v[i][j] == c) {               where.emplace_back(i, j);             }           }         }         if (where.empty()) continue;         sort(where.begin(), where.end(), [](pair<int, int> a, pair<int, int> b) {           return ((int)v[a.first].size()) < ((int)v[b.first].size());         });         int not_first = 0;         pair<int, int> f = where[0];         for (int i = 0; i < ((int)where.size()); i++) {           if (where[i].second != 0) {             not_first++;             f = where[i];           }         }         if (not_first > 1) {           smart_io::precall_print();           cout,  NO ;           return 0;         }         string base = v[f.first];         for (int i = 0; i < ((int)where.size()); i++) {           if (where[i].first == f.first) continue;           if (!expand(base, f.second, v[where[i].first])) {             smart_io::precall_print();             cout,  NO ;             return 0;           }         }         vector<bool> blocked(n, false);         for (pair<int, int> p : where) {           blocked[p.first] = true;         }         vector<string> _new;         for (int i = 0; i < n; i++) {           if (!blocked[i]) {             _new.push_back(v[i]);           }         }         _new.push_back(base);         n = ((int)_new.size());         v = _new;         int tt = 0;       }     }     {} {       sort(v.begin(), v.end());       string rez =   ;       for (string s : v) {         rez += s;       }       if (((int)set<char>(rez.begin(), rez.end()).size()) == ((int)rez.size())) {         smart_io::precall_print();         cout, rez;       } else {         smart_io::precall_print();         cout,  NO ;       }     }   }