#include<bits/stdc++.h>
using namespace std;
struct node{
int id,length;
}len[1001];
int cmp(node x,node y)
{
return x.length>y.length;
}
int main()
{
ios::sync_with_stdio(false);
int i,n;
char a[21][1001];
cin>>n;
for(i=0;i<n;i++)
{
cin>>a[i];
len[i].length=strlen(a[i]);
len[i].id=i;
}
sort(len,len+n,cmp);
cout<<len[0].id+1<<"\n"<<a[len[0].id]<<"\n";
}