// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int n, q, com, x, y;

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

    auto sg = SegTree(n);

    while (q--) {
        scan(com, x, y);

        if (com == 0) {
            sg.update(x, y);
        }
        else {
            int ans = sg.getmin(x, y + 1);
            writeln(ans);
        }
    }
}

struct SegTree {
    private {
        int N = 1;
        int[] data;
        immutable inf = int.max;
    }

    this(int n) {
        while (N < n) N *= 2;
        data = new int[](2*N - 1);
        data[] = inf;
    }

    void update(int i, int x) {
        i += N - 1;
        data[i] = x;

        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = min(data[2*i + 1], data[2*i + 2]);
        }
    }

    int getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = N;
        if (b <= l || r <= a) return inf;
        if (a <= l && r <= b) return data[k];

        int v1 = getmin(a, b, 2*k + 1, l, l + (r - l) / 2);
        int v2 = getmin(a, b, 2*k + 2, l + (r - l) / 2, r);

        return min(v1, v2);
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    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);
        }
    }
}