#include <stdio.h>

#define NMAX 100000
#define INIT 2147483647

int main(){
   int iq, iq2, nq;
   int n;
   int cmd[NMAX], x[NMAX], y[NMAX], min[NMAX];
   scanf("%d %d",&n,&nq);
   for(iq=0;iq<nq;iq++){
      scanf("%d %d %d",cmd+iq,x+iq,y+iq);
      if(cmd[iq]==1) min[iq]=INIT;
   }
   for(iq=0;iq<nq;iq++){
      switch(cmd[iq]){
      case 0 :
         for(iq2=iq+1;iq2<nq;iq2++){
            if(cmd[iq2]==0) continue;
            if(x[iq]<x[iq2]||x[iq]>y[iq2]) continue;
            if(y[iq]<min[iq2]) min[iq2]=y[iq];
         }
         break;
      case 1 : 
         printf("%d\n",min[iq]);
         break;
      }
   }
   return 0;
}