import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;


void main() {
    int n, q;
    scan(n, q);

    auto sd = SqrtDecomp(n);

    foreach (_ ; 0 .. q) {
        auto line = readln.split.to!(int[]);
        if (line[0] == 0) {
            sd.update(line[1], line[2]);
        }
        else {
            writeln(sd.getMin(line[1], line[2] + 1));
        }
    }
}

struct SqrtDecomp {
    private {
        enum sqrtN = 512;
        int N, K;
        int[] bucket;
        int[] data;
    }

    this(int n) {
        N = n;
        K = (N + sqrtN - 1) / sqrtN;
        bucket = new int[](K);
        data = new int[](K * sqrtN);
        bucket[] = int.max;
        data[] = int.max;
    }

    void update(int i, int x) {
        int k = i / sqrtN;
        data[i] = x;
        bucket[k] = int.max;
        foreach (j ; k * sqrtN .. (k + 1) * sqrtN) {
            bucket[k] = min(bucket[k], data[j]);
        }
    }

    int getMin(int l, int r) {
        int res = int.max;

        foreach (k ; 0 .. K) {
            int bl = k * sqrtN, br = (k + 1) * sqrtN;
            if (r <= bl || br <= l) continue;
            if (l <= bl && br <= r) {
                res = min(res, bucket[k]);
            }
            else {
                foreach (i ; max(l, bl) .. min(r, br)) {
                    res = min(res, data[i]);
                }
            }
        }

        return res;
    }
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

