#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using ll = long long; using ld = long double; using ull = unsigned long long; using namespace std; using namespace atcoder; using P = pair; using Graph = vector>; using Priority = priority_queue, greater>;// 昇順 using PriorityPair = priority_queue, greater

>; using mint17 = modint1000000007; using mint998 = modint998244353; using mint = modint; #define mod 1000000007 #define MAX_WIDTH 60 #define MAX_HEIGHT 60 #define inf 1e9 #define INF 8e18 #define MOD 998244353 #define PI 3.141592653589793 #define rep(i, a, b) for(ll i=(a);i<(b);i++) #define rrep(i, a, b) for(ll i=(a);i>=(b);i--) #define fore(i, a) for(auto &i: a) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define YES(a) cout << ((a) ? "YES" : "NO") << endl #define Yes(a) cout << ((a) ? "Yes" : "No") << endl #define First(a) cout << ((a) ? "First" : "Second") << endl #define pb push_back #define fi first #define se second #define vi vector #define vll vector #define vld vector #define vs vector #define vc vector #define vp vector> #define mll map #define msl map #define COUT(n) cout << (n) << endl #define isInGrid(a, b, h, w) (0 <= (a) && (a) < (h) && 0 <= (b) && (b) < (w)) #define isInRange(n, l, r) ((l) <= (n) && (n) < (r)) #define countBit(n) __builtin_popcountll(n) template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a <= b) { a = b; return true; } return false; } template void uniq(T &vec){sort(all(vec)); vec.erase(unique(all(vec)), vec.end());} template bool isOverflowAdd(T a, T b) { return (numeric_limits::max() - a) < b; } template bool isOverflowMul(T a, T b) { return (numeric_limits::max() / a) < b; } int vy4[] = {0, 1, 0, -1}, vx4[] = {1, 0, -1, 0}; int vy8[] = {0, 1, 1, 1, 0, -1, -1, -1}, vx8[] = {1, 1, 0, -1, -1, -1, 0, 1}; struct edge { ll to, cost; }; ll N; string S[1010]; int main() { cin >> N; vector cnt(N, vll(26, 0)); rep(i,0,N) { cin >> S[i]; for(auto c: S[i]) { cnt[i][c-'a']++; } } rep(i,0,N) { rep(add_c,0,26) { cnt[i][add_c]++; // check bool ok = true; rep(j,0,N) { if(i == j) continue; rep(add_c2,0,26) { cnt[j][add_c2]++; bool is_diff = false; rep(k,0,26) { if(cnt[i][k] != cnt[j][k]) is_diff = true; } cnt[j][add_c2]--; if(!is_diff) ok = false; } } if(ok) { string ans = S[i]+(char)('a'+add_c); COUT(ans); return 0; } cnt[i][add_c]--; } } COUT(-1); return 0; }