include[HTML_REMOVED]
using namespace std;
int n;
struct node
{
string name,help;
int s,num;
}str[105];
int find(string qwq)
{
int len=qwq.size();
int anss=0;
for(int i=0;i[HTML_REMOVED]q.s;
}
int main()
{
//freopen(“save.in”,”r”,stdin);
//freopen(“save.out”,”w”,stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1;i<=n;i)
{
cin>>str[i].name>>str[i].help;
str[i].s=find(str[i].help);
str[i].num=i;
}
sort(str+1,str+n+1,cmp);
int tmp=str[1].s;
for(int i=1;i<=n;i)
{
if(str[i].s!=tmp)
{
break;
}
cout<<str[i].name<<” “;
}
cout<<endl<<tmp;
return 0;
}