#include using namespace std; #define rep(i, n) for (int i = 0; i < int(n); i++) #define rev(i, n) for (int i = (n - 1); i >= 0; i--) #define all(x) (x).begin(), (x).end() void YesNo(bool f) {cout << (f ? "Yes\n" : "No\n");}; void fast_io() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } signed main(void) { fast_io(); int N; cin >> N; vector S; vector> mp(N); rep(i, N) { string s; cin >> s; S.push_back(s); map m; for (auto c : s) { m[c]++; } mp[i] = m; } set id; rep(i, N) { rep(j, i) { if (S[i] == S[j]) { id.insert(i); id.insert(j); continue; } if (mp[i] == mp[j]) { cout << -1 << endl; return 0; } } } for (char c = 'a'; c <= 'z'; c++) { rep(i, N) { if (id.count(i)) continue; string T = S[i] + c; sort(all(T)); bool ok = false; rep(j, i) { for (char d = 'a'; d <= 'z'; d++) { string U = S[j] + d; sort(all(U)); ok |= (T == U); } } if (!ok) { cout << T << endl; return 0; } } } cout << -1 << endl; return 0; }