#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <algorithm>
#include <fstream>
using namespace std;
#define lt (2*n)
#define rt (2*n+1)
int n, m, x, y, a[300000];
void up(int n, int l, int r) {
if (l == r) {
a[n] = y;
} else {
int m = (l + r) / 2;
if (x <= m)
up (lt, l, m);
else
up (rt, m + 1, r);
a[n] = max(a[lt], a[rt]);
}
}
int qr(int n, int l, int r) {
if (x <= l && r <= y) {
return a[n];
}
int sol = 0, m = (l + r) / 2;
if (x <= m) sol = max(sol, qr(lt, l, m));
if (y > m) sol = max(sol, qr(rt, m+1, r));
return sol;
}
int main() {
int op;
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
x = i;
scanf("%d", &y);
up(1, 1, n);
}
for (int i = 1; i <= m; i++) {
scanf("%d %d %d", &op, &x, &y);
if (!op) {
printf("%d\n", qr(1, 1, n));
} else {
up(1, 1, n);
}
}
return 0;
}