// editor4
#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int id;
    int time;
    struct node *next;
}Node;
Node *front=NULL,*rear=NULL;
void enqueue(int v,int t){
    Node *newnode=(Node*)malloc(sizeof(Node));
    newnode->id=v;
    newnode->time=t;
    newnode->next=NULL;
    if(front==NULL){
        front=rear=newnode;
    }
    else{
        rear->next=newnode;
        rear=newnode;
    }
}
void dequeue(){
 Node *temp;
 if(front==NULL){
     printf("Queue is empty");
     return;
 }
 for(temp=front;temp!=NULL;temp=temp->next){
     printf("%d\n",temp->id);
     return;
 }
 
}
int main(){
    int size,x,y;
    scanf("%d",&size);
    if(size<0){
        printf("In")
    }
    for(int i=0;i<size;i++){
        scanf("%d %d",&x,&y);
        
        enqueue(x,y);
    }
    dequeue();
    return 0;
}