#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
int n;
string str;
cin >> n;
pair<int, string> p[1000]; // Assuming a maximum of 1000 pairs, you can adjust this based on your needs
for(int i = 0; i < n; i++) {
int cnt = 0;
cin >> str;
p[i].second = str;
sort(str.begin(), str.end());
for(int j = 1; j < str.size(); j++) { // Changed the loop range
if(str[j] != str[j-1]) {
cnt++;
}
}
p[i].first = cnt;
}
sort(p, p + n); // Sort based on the first element of the pair
cout<<p[0].second;
return 0;
}