#include <bits/stdc++.h>
using namespace std;
template<class Node>
struct SegTree {
int n; vector<Node> T;
SegTree(int n) : n(n), T(2 * n) {}
template<class CB>
void Walk(int l, int r, CB&& cb) {
walk(1, 0, n, l, r, cb);
};
template<class CB>
void walk(int x, int b, int e, int l, int r, CB&& cb) {
l = max(l, b); r = min(r, e);
if (l >= r) return;
if (b == l && e == r && cb(T[x], b, e)) return;
int m = (b + e) / 2, z = x + 2 * (m - b);
T[x].push(T[x + 1], T[z]);
walk(x + 1, b, m, l, r, cb);
walk(z, m, e, l, r, cb);
T[x].pull(T[x + 1], T[z]);
}
};
struct Node {
int x = -2e9;
void pull(Node& l, Node& r) {
x = max(l.x, r.x);
}
void push(Node&, Node&) {}
};
int main() {
ifstream cin("arbint.in");
ofstream cout("arbint.out");
int n, q; cin >> n >> q;
SegTree<Node> T(n);
T.Walk(0, n, [&](Node& x, int b, int e) {
if (e - b != 1) return 0;
cin >> x.x; return 1;
});
for (int i = 0; i < q; ++i) {
int t, a, b; cin >> t >> a >> b;
if (t == 0) {
int ans = -2e9;
T.Walk(a - 1, b, [&](Node& x, int _b, int _e) {
ans = max(ans, x.x);
return 1;
});
cout << ans << '\n';
} else {
T.Walk(a - 1, a, [&](Node& x, int _b, int _e) {
x.x = b;
return 1;
});
}
}
return 0;
}