using namespace std;
bool cmp(pair<string,int>p1,pair<string,int>p2){
return p1.second < p2.second;
}
int main(){
int n;
string s,s1;
vector<pair<string,int>>v;
cin >> n;
while(n--){
cin >> s;
s1 = s;
int n=s.size();
int cnt=0;
sort(s.begin(),s.end());
for(int i=0;i<n;i++){
if(s[i] != s[i+1])cnt++;
}
v.push_back({s1,cnt});
}
int mn=INT_MAX;
for(int i=0;i<v.size();i++){
if(v[i].second < mn){
mn = v[i].second;
}
}
sort(v.begin(),v.end(),cmp);
int idx;
bool f=true;
for(int i=0;i<v.size();i++){
if(v[0].second != v[1].second){
cout << v[i].first;
f=false;
break;
}
if(v[i].second == mn){
if(v[i].first < v[i+1].first){
v[i+1].first = v[i].first;
idx = i;
}
}
}
if(f)cout << v[idx].first;
}