#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define REP(i,n) for(long long i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
ll INF = 1LL << 60;
const ll sqrtN = 512; //* 512*512=262144 > 10^5

//* reference: https://kujira16.hateblo.jp/entry/2016/12/15/000000
//* Range Sum Query (RSQ) implemented using sqrt decomposition
struct RSQ{ 
    ll N, K; //* N length of data, K number of buckets
    vll data;
    vll bucketSum;
    //* allocate memory with zeros
    void init(ll n){
        N = n;
        K = (n + sqrtN - 1) / sqrtN; //* number of buckets = ceil(n/sqrtN)
        data.assign(K * sqrtN, 0);
        bucketSum.assign(K, 0);
    }
    //* constructor
    RSQ(ll n){ init(n);}
    //* constructor with init vector data
    RSQ(ll n, vll &a){
        init(n);
        REP(i, n){
            data[i] = a[i];
        }
        REP(k, K){
            ll sum = 0;
            for(ll j = k * sqrtN; j < (k + 1)* sqrtN; j++){
                sum += data[j];
            }
            bucketSum[k] = sum;
        }
    }
    //* update (add(i, x) -> a[i]+= x)
    void add(ll i, ll x){
        ll k = i / sqrtN; //* corresponding bucket
        data[i] += x;
        ll sum = 0;
        for(ll j = k * sqrtN ; j < (k + 1)*sqrtN; j ++){
            sum += data[j];
        }
        bucketSum[k] = sum;
    }
    //* getSum(s, t)-> return a[s]+a[s+1]+...+a[t-1]
    //* [x, y)
    ll getSum(ll x, ll y){
        ll sum = 0;
        REP(k, K){
            ll l= k * sqrtN, r = (k+1) * sqrtN; //* bucket [l, r)
            if(r <= x || y <= l) //* no intersection
                continue;
            if(x <= l && r <= y) {//* [l, r) in [x, y)
                sum += bucketSum[k]; //* use bucket data
            }
            else{ //* has intersection on boundary
                for(ll i = max(l, x); i < min(r, y); i++){
                    sum += data[i];
                }
            }
        }
        return sum;
    }
};

struct RMQ{
    ll N, K;
    vll data;
    vll bucketMin;
    //* allocate memory with zeros
    void init(ll n){
        N = n;
        K = (n + sqrtN - 1) / sqrtN; //* number of buckets = ceil(n/sqrtN)
        data.assign(K * sqrtN, INF);
        bucketMin.assign(K, INF);
    }
    //* constructor
    RMQ(ll n){ init(n);}
    //* constructor with init vector data
    RMQ(ll n, vll &a){
        init(n);
        REP(i, n){
            data[i] = a[i];
        }
        REP(k, K){
            ll tmp = INF;
            for(ll j = k * sqrtN; j < (k + 1)* sqrtN; j++){
                tmp =min(tmp, data[j]);
            }
            bucketMin[k] = tmp;
        }
    }
    //* update a[i] = x
    void update(ll i, ll x){
        ll k = i / sqrtN; //* corresponding bucket
        if(x <= data[i]){ //* fast update
            data[i] = x;
            bucketMin[k] = min(x, bucketMin[k]);
            return;
        }
        data[i] = x;
        ll tmp = x;
        for(ll j = k * sqrtN; j < (k+1)*sqrtN; j++){
            tmp = min(tmp, data[j]);
        }

        bucketMin[k] = tmp;
    }
    //* find(s, t)-> return min(a[s], a[s+1], ..., a[t-1])
    //* [x, y)
    ll find(ll x, ll y){
        ll tmp = INF;
        REP(k, K){
            ll l= k * sqrtN, r = (k+1) * sqrtN; //* bucket [l, r)
            if(r <= x || y <= l) //* no intersection
                continue;
            if(x <= l && r <= y) {//* [l, r) in [x, y)
                tmp = min(tmp, bucketMin[k]); //* use bucket data
            }
            else{ //* has intersection on boundary
                for(ll i = max(l, x); i < min(r, y); i++){
                    tmp = min(tmp, data[i]);
                }
            }
        }
        return tmp;
    }
};


void solveRSQ(){
    ll N, Q;
    cin >> N >> Q;
    RSQ st(N);
    REP(q, Q){
        ll com;
        cin >> com;
        if(com){
            ll x, y;
            cin >> x >> y;
            cout << st.getSum(x-1, y)<<endl;
        }
        else{
            ll i, x;
            cin >> i >> x;
            st.add(i-1, x);
        }
    }

}

void solveRMQ(){
    ll n, q;
    cin >> n >> q;
    vll a(n, (1LL<<31)-1);
    RMQ st(n, a);
    REP(_, q){
        ll com;
        cin >> com;
        if(com){//* 
            ll x, y;
            cin >> x >> y;
            cout << st.find(x, y+1) << endl;
        }
        else{ //* update
            ll i, y;
            cin >> i >> y;
            st.update(i, y);
        }
    }
}

int main(){
    //* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B
    // solveRSQ();
    //* http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A
    solveRMQ();
    return 0;
}


Measured memory_bytes: 4352