#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P x){
 
  Q[tail]=x;
  if(tail+1==n) Q[tail].t=0;
  else Q[tail].t=Q[tail].t+1;
  
}

P dequeue(P x){
  
 x=Q[head];
  if(head+1==n) Q[head].t=0;
  else Q[head].t=Q[head+1].t;
  return x;
}


int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  
  return 0;
}