#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false);cin.tie(0);
#define setnow clock_t tStart=clock();
#define time (double)(clock() - tStart)/CLOCKS_PER_SEC;
#define setin(x) ifstream cin(x);
#define setout(x) ofstream cout(x);
typedef long long ll;
typedef long long int lli;
typedef pair < int, int> dbl;
const int maxInt = 1e9*2;
const lli maxLong = 1e18*2;
map <string, bool > mp;
string names[123];
int main(){
		//ifstream cin("input.in");
		int n;
		cin >> n;
		for(int i=0;i<n;i++){
				cin >> names[i];
				mp[names[i]] = true;
		}
		bool ok;
		ok = false;
		string ans;
		for(int k=0;k<n;k++){
						string word = names[k];
						int i = 0;
						int j = 0;
						while(j < word.size()){
								string sub;
								for(int o=i;o<=j;o++)
									sub+=word[o];
								if(mp[sub] && sub != word){
									i=j+1;
									j = i;
								} else j++;
						}
						//cout << i << ' ' << j << ' ' << word.size() << endl;
						if(i==j && j == word.size() ){
							if(word.size() > ans.size())
								ans = word;
						}	
		}	
		if(ans.size() > 0)
			cout << ans << endl;
		else cout << -1;
		return(0);
}