#include<stdio.h>
#include<math.h>
#include<limits.h>
#define MAX 100000


int min(int a,int b){
 if(a < b)return a;

 return b;
}




int main(){
 int n,q,i,com,j,mini;
 int x,y;
 int A[MAX];
 int B[MAX];
 int b,L,R;

 scanf("%d %d",&n,&q);
 b=floor(sqrt(n));

 for(i=0;i<n;i++){
   A[i]=INT_MAX;
   B[i]=INT_MAX;
 }


 for(i=0;i<q;i++){

   scanf("%d %d %d",&com,&x,&y);

   if(com==0){/*update*/
     A[x]=y;
     B[x/b]=min(A[x],B[x/b]);
   }

   else if(com==1){/*find*/
     L=x/b; R=y/b; mini=INT_MAX;
     for(j=x;j<(L+1)*b;j++)mini=min(mini,A[j]);
     for(j=L+1;j<R;j++)mini=min(mini,B[j]);
     for(j=R*b;j<=y;j++)mini=min(mini,A[j]);

     printf("%d\n",mini);
   }

 }


return 0;
}
