#include <bits/stdc++.h>
using namespace std;

int main() {
    //ifstream cin("B.in");
    int n; cin >> n;    
    
    vector<string> a(n);
    for(int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a.begin(), a.end(), [&] (string x, string y) {
        return x.size() > y.size();
    });
    

    for(int idx = 0; idx < n; ++idx) {
        string now = a[idx];
        int m = now.size();
        vector<int> dp(m, 0);

        for(int i = 0; i < m; ++i) {
            if(i == 0 or(dp[i - 1])) {
                for(int j = idx + 1; j < n; ++j) {
                    string add = a[j];
                    int len = add.size();
                    if(i + len - 1 >= m)
                        continue;
                    if(now.substr(i, len) != add)
                        continue;
                    dp[i + len - 1] = 1;
                }
            }
        }

        if(dp[m - 1]) {
            cout << now << "\n";
            return 0;
        }
    }

    cout << -1 << "\n";
}