#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for(auto &&s : a){ cin >> s; sort(s.begin(), s.end()); } sort(a.begin(), a.end()); if(a[0] == a.back()){ cout << "-1\n"; return 0; } cout << 'a' << a[0] << '\n'; }