#include<stdio.h>
#define Mas 100
typedef int KeyType;
typedef struct{
KeyType kx;
int age;
char name[10];
}DataType;
typedef struct{
DataType data[Mas];
int length;
}S_T;
S_T *init(){
S_T *s=new S_T;
int i,j;
j=1;
scanf("%d",&i);
// input flag programming over
while(j<i){
scanf("%d %d %s",&s->data[j].kx,&s->data[j].age,s->data[j].name);
j++;
}
// s->data[i]="\0";
s->length=j-1;
return s;
}
int Binary_Search(S_T *t,int kx){
int low,high,mid;
int flag;
low=1;
high=t->length;
flag=-1;
while(low<=high){
mid=(low+high)/2;
if(kx<t->data[mid].kx)
high=mid-1;
else
if(kx>t->data[mid].kx)
low=mid+1;
else{
flag=mid;
break;
}
}
return flag;
}
int main(){
int position;
int x;
scanf("%d",&x);
position=Binary_Search(init(),x);
printf("%d\n",position);
return 0;
}
#define Mas 100
typedef int KeyType;
typedef struct{
KeyType kx;
int age;
char name[10];
}DataType;
typedef struct{
DataType data[Mas];
int length;
}S_T;
S_T *init(){
S_T *s=new S_T;
int i,j;
j=1;
scanf("%d",&i);
// input flag programming over
while(j<i){
scanf("%d %d %s",&s->data[j].kx,&s->data[j].age,s->data[j].name);
j++;
}
// s->data[i]="\0";
s->length=j-1;
return s;
}
int Binary_Search(S_T *t,int kx){
int low,high,mid;
int flag;
low=1;
high=t->length;
flag=-1;
while(low<=high){
mid=(low+high)/2;
if(kx<t->data[mid].kx)
high=mid-1;
else
if(kx>t->data[mid].kx)
low=mid+1;
else{
flag=mid;
break;
}
}
return flag;
}
int main(){
int position;
int x;
scanf("%d",&x);
position=Binary_Search(init(),x);
printf("%d\n",position);
return 0;
}