#include #include using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ll mod=998244353; ll inf=1000000000000000000; int main(){ ll n; cin >> n; vectors(n); for (ll i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(),s[i].end()); } for (ll i = 0; i < n; i++) { mapmemo,memo2; for (ll j = 0; j < s[i].size(); j++) { memo2[s[i][j]]++; } bool ok=true; for (ll j = 0; j < n; j++) { if (j==i) { continue; } memo=memo2; bool o=true; for (ll k = 0; k < s[j].size(); k++) { if (memo[s[j][k]]==0) { o=false; break; }else{ memo[s[j][k]]--; } } if (o) { ok=false; break; } } if (ok) { cout << s[i] << endl; return 0; } } cout << -1 << endl; }