#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <type_traits>
#include <utility>
#include <vector>

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;
using intl32 = std::int_least32_t;
using intl64 = std::int_least64_t;
using uintl32 = std::uint_least32_t;
using uintl64 = std::uint_least64_t;


template<typename Monoid>
class AVL {
	static constexpr uint64 ALLOCSIZE = (uint64)1 << 10;
	struct node_t {
		node_t *left, *right;
		uintl32 size, height, ref;
		Monoid data;
		void gc(void) {
			left->reset();
			right->reset();
			left = pool_;
			pool_ = this;
		}
		void reset(void) {
			if (!--ref) gc();
		}
		//leftが高い
		node_t *adjustL(void) {
			if (right->height + 3 != height) {
				return this;
			}
			node_t *ret = left->right;
			if (left->left->height + 1 == ret->height) {
				ret = make(make(left->left, ret->left), make(ret->right, right));
			}
			else {
				ret = make(left->left, make(ret, right));
			}
			gc();
			return ret;
		}
		node_t *adjustR(void) {
			if (left->height + 3 != height) {
				return this;
			}
			node_t *ret = right->left;
			if (right->right->height + 1 == ret->height) {
				ret = make(make(left, ret->left), make(ret->right, right->right));
			}
			else {
				ret = make(make(left, ret), right->right);
			}
			gc();
			return ret;
		}
		node_t *insert_(uint32 pos) {
			if (size != 1) {
				if (left->size > pos) {
					return make(left->insert_(pos), right)->adjustL();
				}
				else {
					return make(left, right->insert_(pos - left->size))->adjustR();
				}
			}
			if (pos) {
				return make(this, data_);
			}
			else {
				return make(data_, this);
			}
		}
		node_t *erase_(uint32 pos) {
			if (size > 3) {
				if (left->size > pos) {
					return make(left->erase_(pos), right)->adjustR();
				}
				else {
					return make(left, right->erase_(pos - left->size))->adjustL();
				}
			}
			if (size != 3) {
				if (pos) return left;
				return right;
			}
			if (left->size == 1) {
				if (!pos) return right;
				return make(left, right->erase_(pos - 1));
			}
			else {
				if (pos == 2) return left;
				return make(left->erase_(pos), right);
			}
		}
		void show(void) {
			std::cout << "(";
			if (left != nil) {
				left->show();
				std::cout << "←";
			}
			std::cout << data.e << " " << size;
			if (right != nil) {
				std::cout << "→";
				right->show();
			}
			std::cout << ")";
		}
	};
	static node_t *pool_, *nil, *data_;
	node_t *root_;
	AVL(node_t *root) :root_(root) {
		++root->ref;
	}
	static node_t *alloc(void) {
		if (!pool_) {
			pool_ = (node_t *)malloc(ALLOCSIZE*(uint64)sizeof(node_t));
			uint32 i = ALLOCSIZE;
			while (--i) {
				pool_[i - 1].left = pool_ + i;
			}
		}
		node_t *ret = pool_;
		pool_ = pool_->left;
		return ret;
	}
	static node_t *make(node_t *l, node_t *r) {
		node_t *ret = alloc();
		ret->left = l;
		ret->right = r;
		ret->size = l->size + r->size;
		ret->height = std::max(l->height, r->height) + 1;
		ret->ref = 0;
		ret->data = l->data + r->data;
		++l->ref;
		++r->ref;
		return ret;
	}
public:
	AVL() :root_(nil) { ++nil->ref; }
	AVL(const AVL &other) :root_(other.root_) { ++root_->ref; }
	AVL &operator=(const AVL &other) {
		root_->reset();
		root_ = other.root_;
		++root_->ref;
		return *this;
	}
	~AVL() { root_->reset(); }
	Monoid access(uint32 index) {
		node_t *n = root_;
		while (n->size != 1) {
			if (n->left->size <= index) {
				index -= n->left->size;
				n = n->right;
			}
			else {
				n = n->left;
			}
		}
		return n->data;
	}
	AVL insert(uint32 position, const Monoid &data) {
		data_ = make(nil, nil);
		data_->data = data;
		data_->size = 1;
		if (root_ == nil) {
			return AVL(data_);
		}
		return AVL(root_->insert_(position));
	}
	AVL erase(uint32 position) {
		return AVL(root_->erase_(position));
	}
	Monoid range(uint32 begin, uint32 end) {
		node_t *n = root_, *m;
		Monoid ret;
		while (1) {
			if (n->left->size >= begin) {
				if (n->left->size <= end) {
					if ((!begin) && (end == n->size)) return n->data;
					end -= n->left->size;
					break;
				}
				n = n->left;
			}
			else {
				begin -= n->left->size;
				end -= n->left->size;
				n = n->right;
			}
		}
		m = n->right;
		n = n->left;
		if (begin) {
			while (n != nil) {
				if (n->left->size < begin) {
					begin -= n->left->size;
					n = n->right;
				}
				else {
					ret = n->right->data + ret;
					n = n->left;
				}
			}
		}
		else {
			ret = n->data;
		}
		if (end != m->size) {
			while (m != nil) {
				if (m->left->size <= end) {
					end -= m->left->size;
					ret = ret + m->left->data;
					m = m->right;
				}
				else {
					m = m->left;
				}
			}
		}
		else {
			ret = ret + m->data;
		}
		return ret;
	}
	void show(void) {
		root_->show();
		std::cout << "\n";
	}
};
template<typename Monoid>
typename AVL<Monoid>::node_t *AVL<Monoid>::pool_ = nullptr;
template<typename Monoid>
typename AVL<Monoid>::node_t *AVL<Monoid>::data_ = nullptr;
template<typename Monoid>
typename AVL<Monoid>::node_t *AVL<Monoid>::nil = [] {
	nil = new AVL<Monoid>::node_t;
	nil->left = nil;
	nil->right = nil;
	nil->size = 0;
	nil->height = 0;
	nil->ref = 1000;
	nil->data = Monoid();
	return nil;
}();
struct MIN {
	int64 e;
	MIN(int64 x = std::numeric_limits<int64>::max()) :e(x) {}
	MIN operator~() {
		return *this;
	}
	MIN operator+(const MIN &other) {
		if (e < other.e) return *this;
		return other;
	};
	MIN operator*(const MIN &other) {
		return other;
	}
};
int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n, q;
	std::cin >> n >> q;
	AVL<MIN> T;
	while (n--) {
		T = T.insert(0, MIN(2147483647));
	}
	uint32 c, x, y;
	while (q--) {
		//T.show();
		std::cin >> c >> x >> y;
		if (c) {
			std::cout << T.range(x, y + 1).e << "\n";
		}
		else {
			T = T.erase(x);
			//T.show();
			T = T.insert(x, MIN(y));
		}
	}
	return 0;
}


Measured memory_bytes: 11024