ll*p,*q,x,y,a[90][3d5];{rd(x);REP(i,x)rd(x,y),p=a[(x+y*5)%10*9+y%9],p[++*p]=i+1,q=q&&*q>*p?q:p;wt(q(*q+1));}