#include<stdio.h>
#define M 100000

typedef struct{
  char name[10];
  int time[M];
}Que;

int enqueue(int);
int dequeue(void);
int head=0,tail=0;


main(){

  Que p[M];
  int i,j,n,q,k;

  scanf("%d%d",&n,&q);
    for(i=0;i<n;i++){
      scanf("%c%d",&p[i].name,&p[i].time);
      enqueue(p[i].time);
    }
  


}


int enqueue(int x){

  int Q[M];
  int MAX;

  Q[tail] = x;

  if(Q[tail+1]==MAX){
    tail=0;
  }

  else tail++;
  return Q;
}

int dequeue(){

  int x,Q[M];
  int MAX;
  x=Q[head];

  if(Q[head+1]==MAX){
    head=0;
  }
  else head++;
  return x;
}