#include <bits/stdc++.h>                                                                       
                                                                                               
using namespace std;                                                                           
                                                                                               
#define all(x) x.begin(), x.end()                                                              
#define rep(i, n) for (int i = 0; i < n; ++i)                                                  
#define reps(i, m, n) for (int i = m; i <= n; ++i)                                             
                                                                                               
using i64 = long long;                                                                         
using pii = pair<i64, i64>;                                                                    
                                                                                               
template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}     
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}     
                                                                                               
constexpr int INF = 0x3f3f3f3f;                                                                
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;                                                     
constexpr int mod = int(1e9) + 7;                                                              
                                                                                               
template<typename Monoid> struct SegmentTree {                                                 
  using Func = function<Monoid(Monoid, Monoid)>;                                               
  const int sz;                                                                                
  const Func fn;                                                                               
  const Monoid unity;                                                                          
  vector<Monoid> seg;                                                                          
                                                                                               
  SegmentTree(int n, const Monoid &u, Func f)                                                  
    : sz(1 << (__lg(n + 5) + 1)), fn(f), unity(u), seg(sz * 2, unity) {}                       
                                                                                               
  void set(int k, const Monoid &v) { seg[k+sz] = v; }                                          
                                                                                               
  Monoid& operator[](int k) { return seg[k+sz]; }                                              
  const Monoid& operator[](int k) const { return seg[k+sz]; }                                  
                                                                                               
  void build() { for (int k = sz - 1; k > 0; --k) seg[k] = fn(seg[2*k], seg[2*k+1]); }         
                                                                                               
  void update(int k, const Monoid &x) {                                                        
    k += sz;                                                                                   
    seg[k] = x;                                                                                
    while (k >>= 1) seg[k] = fn(seg[2*k], seg[2*k+1]);                                         
  }                                                                                            
                                                                                               
  Monoid query(int a, int b) const {                                                           
    Monoid L = unity, R = unity;                                                               
    for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {                                          
      if (a & 1) L = fn(L, seg[a++]);                                                          
      if (b & 1) R = fn(seg[--b], R);                                                          
    }                                                                                          
    return fn(L, R);                                                                           
  }                                                                                            
};                                                                                             
                                                                                               
signed main()                                                                                  
{                                                                                              
  ios::sync_with_stdio(false);                                                                 
  cin.tie(nullptr);                                                                            
  int N, Q;                                                                                    
  cin >> N >> Q;                                                                               
  SegmentTree<int> seg(N, INT_MAX, [](int a, int b) { return min(a, b); });                    
  rep(i, Q) {                                                                                  
    int com, x, y; cin >> com >> x >> y;                                                       
    if (!com) seg.update(x, y);                                                                
    else cout << seg.query(x, y + 1) << "\n";                                                  
  }                                                                                            
  return 0;                                                                                    
}                                                                                              


Measured memory_bytes: 3852