#include <stdio.h>
#define INIT 2147483647
#define MAX_N 100000

int min(int *array, int begin, int end) {
	int i, m;

	m = array[begin];
	for (i = begin+1; i < end; i++) {
		if (array[i] < m) {
			m = array[i];
		}
	}
	return m;
}

int main(void) {
	int num, q, i;
	int a[MAX_N], b[MAX_N];
	int com, x, y, bx, by, tmp, m;

	scanf("%d %d", &num, &q);

	for (i = 0; i < num; i++) {
		a[i] = b[i] = INIT;
	}

	while (q--) {
		scanf("%d %d %d", &com, &x, &y);
		if (com) {
			bx = x - x % 100 + 100;
			by = y - y % 100;
			if (bx < by) {
				m = min(a, x, bx);
				tmp = min(b, bx/100, by/100);
				m = m < tmp ? m : tmp;
				tmp = min(a, by, y+1);
				m = m < tmp ? m : tmp;
			} else {
				m = min(a, x, y+1);
			}
			printf("%d\n", m);
		} else {
			a[x] = y;
			bx = x - x % 100;
			b[x/100] = min(a, bx, bx+100);
		}
	}
	return 0;
}