#include <iostream>
#include <fstream>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <forward_list>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <string>
#include <bitset>
#include <memory>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <cstdint>
#include <iomanip>
#include <tuple>
#include <random>

#include <queue>
#include <vector>
#include <utility>
template <class Tval>
class rmq {
private:
    class node {
    public:
        unsigned int children[2];
        unsigned int parent;
        unsigned int begin;
        unsigned int split;
        unsigned int end;
        Tval value;
    };
    std::vector<node> tree;
public:
    rmq(const std::vector<Tval>& elements) {
        initialize(elements);
    }
    void initialize(const std::vector<Tval>& elements) {
        node temp;
        for(int i = 0;i < elements.size();i++) {
            temp.value = elements[i];
            temp.children[0] = i;
            temp.children[1] = i;
            temp.begin = i;
            temp.split = i + 1;
            temp.end = i + 1;
            tree.push_back(temp);
        }
        unsigned int cur = 0;
        while(tree[cur].begin != 0 || tree[cur].end != elements.size()) {
            if(tree[cur].end != elements.size()) {
                temp.begin = tree[cur].begin;
                temp.split = tree[cur].end;
                temp.end = tree[cur+1].end;
                temp.children[0] = cur;
                temp.children[1] = cur+1;
                temp.value = std::min(tree[cur].value,tree[cur+1].value);
                tree[cur].parent = tree.size();
                tree[cur+1].parent = tree.size();
                cur = cur + 2;
            }
            else
            {
                temp.begin = tree[cur].begin;
                temp.split = tree[cur].split;
                temp.end = tree[cur].end;
                temp.children[0] = tree[cur].children[0];
                temp.children[1] = tree[cur].children[1];
                temp.value = tree[cur].value;
                tree[cur].parent = tree.size();
                cur = cur + 1;
            }
            tree.push_back(temp);
        }
        tree[tree.size()-1].parent = tree.size();
    }
    Tval query(unsigned int begin,unsigned int end) {
        Tval retval = Tval();
        bool initial = true;
        std::queue<std::pair<std::pair<unsigned int,unsigned int>,unsigned int>> range;
        range.push(std::make_pair(std::make_pair(begin,end),tree.size()-1));
        while(!range.empty()) {
            auto t = range.front();
            range.pop();
            if(t.first.first == tree[t.second].begin && t.first.second == tree[t.second].end) {
                if(initial) {
                    retval = tree[t.second].value;
                    initial = false;
                }
                else
                    retval = std::min(retval,tree[t.second].value);
                continue;
            }
            if(t.first.second > tree[t.second].split) {
                range.push(std::make_pair(std::make_pair(std::max(tree[t.second].split,t.first.first),t.first.second),tree[t.second].children[1]));
            }
            if(t.first.first < tree[t.second].split) {
                range.push(std::make_pair(std::make_pair(t.first.first,std::min(tree[t.second].split,t.first.second)),tree[t.second].children[0]));
            }
        }
        return retval;
    }
    void update(unsigned int index,Tval element) {
        tree[index].value = element;
        int cur = tree[index].parent;
        while(cur != tree.size()) {
            if(tree[cur].value == std::min(tree[tree[cur].children[0]].value,tree[tree[cur].children[1]].value))
                break;
            else {
                tree[cur].value = std::min(tree[tree[cur].children[0]].value,tree[tree[cur].children[1]].value);
                cur = tree[cur].parent;
            }
        }
    }
};

using  namespace std;
int main(void) {
    int n,q;
    cin >> n >> q;
    vector<unsigned int> a;
    for(int i = 0; i < n;i++) {
        a.push_back(0x7fffffff);
    }
    rmq<unsigned int> r(a);
    for(int i = 0;i < q;i++) {
        int c,x,y;
        cin >> c >> x >> y;
        if(c == 0)
            r.update(x, y);
        else
            cout << r.query(x,y+1) << endl;
    }
    return 0;
}



Measured memory_bytes: 10496