#include <stdio.h>

#define NMAX 100000
#define INIT 2147483647

int main(){
   int iq, iq2, nq;
   int cmd[NMAX], x[NMAX], y[NMAX], min[NMAX], min_tmp;
   int ia, na, array[NMAX];
   scanf("%d %d",&na,&nq);
   for(ia=0;ia<na;ia++) array[ia]=INIT;
   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 :
         array[x[iq]]=y[iq];
         break;
      case 1 : 
         min_tmp=INIT;
         for(iq2=iq-1;iq2>=0;iq2--){
            if(cmd[iq2]==0&&x[iq2]>=x[iq]&&x[iq2]<=y[iq]) break;
            if(cmd[iq2]==1&&x[iq2]==x[iq]&&y[iq2]==y[iq]){
               min_tmp=min[iq2]; break;
            }
         }
         if(min_tmp!=INIT){
            printf("%d\n",min_tmp);
            min[iq]=min_tmp;
            break;
         }
         for(ia=x[iq];ia<=y[iq];ia++){
            if(array[ia]<min_tmp) min_tmp=array[ia]; 
         }
         printf("%d\n",min_tmp);
         min[iq]=min_tmp;
         break;
      }
   }
   return 0;
}