#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>

#define max_n 100000

using namespace std;

typedef long long ll;

const int B=1000;

ll a[max_n],m[max_n/B];

void update(int i,int x){
  a[i]=x;
  for(int j=i/B;j<i/B+B;j++)
    m[i/B]=min(m[i/B],a[j]);
}

int find(int s,int t){
  ll res=INT_MAX;

  if(s/B==t/B){
    for(int i=s;i<=t;i++)res=min(res,a[i]);
    return res;
  }

  for(int i=s/B+1;i<t/B;i++){
    res=min(res,m[i]);
  }
  
  for(int i=s;i<s-s%B+B;i++)res=min(res,a[i]);
  for(int i=t-t%B;i<=t;i++)res=min(res,a[i]);

  return res;
}

int main(void){
  int n,q;

  cin >> n >> q;

  fill(m,m+max_n/B,INT_MAX);
  fill(a,a+max_n,INT_MAX);

  int com,x,y;
  for(int i=0;i<q;i++){
    cin >> com >> x >> y;
    
    if(com==0)update(x,y);
    else cout << find(x,y) << endl;
  }
  
  return 0;
}