#include <bits/stdc++.h>
using namespace std;

const int MAX = 1 << 17;

int main()
{
	int n, q;
	scanf("%d%d", &n, &q);
	vector<int> v(MAX << 1, INT_MAX);
	while (q--) {
		int com, x, y;
		scanf("%d%d%d", &com, &x, &y);
		if (com == 0) {
			for (v[x += MAX] = y; x > 1; x >>= 1) {
				v[x >> 1] = min(v[x], v[x ^ 1]);
			}
		}
		else {
			int res = INT_MAX;
			for (x += MAX, y += MAX + 1; x < y; x >>= 1, y >>= 1) {
				if (x & 1) res = min(res, v[x++]);
				if (y & 1) res = min(res, v[--y]);
			}
			printf("%d\n", res);
		}
	}
	return 0;
}

