#include<stdio.h>
int arb[1000000];
int a, b;
void update(int nod, int st, int dr) {
if (st == dr) {
arb[nod] = b;
return;
} else {
int mij = (st + dr) >> 1, fs = nod << 1, fd = (nod << 1) + 1;
if (a <= mij)
update(fs, st, mij);
else
update(fd, mij + 1, dr);
if (arb[fs] > arb[fd])
arb[nod]=arb[fs];
else
arb[nod]=arb[fd];
}
}
int query(int nod, int st, int dr) {
if (a <= st && dr <= b)
return arb[nod];
else {
int mij = (st + dr) >> 1, fs = nod << 1, fd = (nod << 1) + 1;
int ml, mr;
mr = ml = 0;
if (a <= mij)
ml = query(fs, st, mij);
if (b > mij)
mr = query(fd, mij + 1, dr);
return (ml > mr) ? ml : mr;
}
}
int main() {
int n, m, x, i;
freopen("arbint.in", "r", stdin);
freopen("arbint.out", "w", stdout);
scanf("%d%d", &n, &m);
for (a = 1; a <= n; a++) {
scanf("%d", &b);
update(1, 1, n);
}
for (i = 0; i < m; i++) {
scanf("%d%d%d", &x, &a, &b);
if (x == 0)
printf("%d\n", query(1, 1, n));
else
update(1, 1, n);
}
return 0;
}