#include <vector>
#include <functional>
#include <algorithm>
#include <iostream>
#include <climits>
using namespace std;

// 抽象 SegmentTree (0-indexed・一点更新・区間取得)
// static な update, combine 関数を持つクラスを別途定義して使う
template <typename MonoidType, class SegFunc>
struct SegmentTree {
    // node, identity element
    int n;
    vector<MonoidType> node;
    MonoidType E0;

    inline void build(int m, const vector<MonoidType> &v = vector<MonoidType>()) {
        if(v.size()) m = v.size();
        n = 1; while(n < m) n <<= 1;

        node = vector<MonoidType>(n << 1, E0);
        if(v.size()) {
            for(int i=0; i<m; i++) {
                node[n+i] = v[i];
            }
            for(int i=n-1; i>=1; i--) {
                node[i] = SegFunc::combine(node[i << 1], node[i << 1 | 1]);
            }
        }
    }

    // initialize
    SegmentTree() {}
    SegmentTree(int n_, MonoidType E0_,
                vector<MonoidType> v = vector<MonoidType>()) : E0(E0_) {
        build(n_, v);
    }

    // update k-th element (applied value: x)
    void update(int k, MonoidType x) {
        k += n;
        node[k] = SegFunc::update(node[k], x);
        while(k > 0) {
            k >>= 1;
            node[k] = SegFunc::combine(node[k << 1], node[k << 1 | 1]);
        }
    }

    // range query for [a, b)
    // 非再帰のアイデア: http://d.hatena.ne.jp/komiyam/20131202/1385992406
    MonoidType query(int a, int b) {
        MonoidType vl = E0, vr = E0;
        for(int l=a+n, r=b+n; l<r; l>>=1, r>>=1) {
            if(l & 1) vl = SegFunc::combine(vl, node[l++]);
            if(r & 1) vr = SegFunc::combine(node[--r], vr);
        }
        return SegFunc::combine(vl, vr);
    }
};

// Verified on Apr 27, 2019
// Judge: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A

// Range Minimum Query
// query 1: update
// query 2: range minimum

void DSL_2_A() {
    struct SegFunc {
        static int update(int a, int b) { return b; }
        static int combine(int a, int b) { return min(a, b); }
    };

    int N, Q; cin >> N >> Q;
    SegmentTree<int, SegFunc> seg(N, INT_MAX);

    int indexed = 0;
    for(int i=0; i<Q; i++) {
        int query_type; cin >> query_type;
        int x, y; cin >> x >> y;
        if(query_type == 0) {
            x -= indexed;
            seg.update(x, y);
        }
        if(query_type == 1) {
            x -= indexed, y -= indexed;
            y++;
            cout << seg.query(x, y) << endl;
        }
    }
}

/*
// Verified on Apr 27, 2019
// Judge: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B

// Range Sum Query
// query 1: add
// query 2: range sum
void DSL_2_B() {
    int N, Q; cin >> N >> Q;
    SegmentTree<int> seg(N, 0,
                         [](int a, int b) { return a + b; },
                         [](int a, int b) { return a + b; });

    int indexed = 1;
    for(int i=0; i<Q; i++) {
        int query_type; cin >> query_type;
        int x, y; cin >> x >> y;
        if(query_type == 0) {
            x -= indexed;
            seg.update(x, y);
        }
        if(query_type == 1) {
            x -= indexed, y -= indexed;
            y++;
            cout << seg.query(x, y) << endl;
        }
    }
}
*/

int main() {
    DSL_2_A();
    // DSL_2_B();
    return 0;
}



Measured memory_bytes: 3872