#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; using mint = modint998244353; int main() { int N; cin >> N; vector> vec(N); vector flag(N, true); for (int i = 0; i < N; i++) { string s; cin >> s; for (int j = 0; j < s.size(); j++) { vec[i][s[j]]++; } for (int j = 0; j < i; j++) { if (vec[i] == vec[j]) flag[i] = flag[j] = false; } } for (int i = 0; i < N; i++) { if (flag[i]) { for (auto p: vec[i]) { for (int j = 0; j < p.second; j++) cout << p.first; } cout << 'a' << endl; return 0; } } cout << -1 << endl; return 0; }