#include <iostream>
#include <fstream>
using namespace std;
const int MAX_N = 1e5+2;
int v[MAX_N];
int n, q;
void update(int nod, int st, int dr, int a, int b, int val)
{
if(a <= st && dr <= b)
v[nod] = val;
else
{
int m = (st + dr) / 2;
if(a <= m)
update(2 * nod, st, m, a, b, val);
if(b > m)
update(2 * nod + 1, m + 1, dr, a, b, val);
v[nod] = max(v[2 * nod], v[2 * nod + 1]);
}
}
int query(int nod, int st, int dr, int a, int b)
{
if(a <= st && dr <= b)
return v[nod];
else
{
int m = (st + dr) / 2, rezst = 0, rezdr = 0;
if(a <= m)
rezst = query(2 * nod, st, m, a, b);
if(b > m)
rezdr = query(2 * nod + 1, m + 1, dr, a, b);
return max(rezst, rezdr);
}
}
int main()
{
ifstream f("arbint.in");
ofstream g("arbint.out");
f >> n >> q;
for(int i = 1, x; i <= n; i++)
{
f >> x;
update(1, 1, n, i, i, x);
}
for(int c, a, b; q; q--) {
f >> c >> a >> b;
if(c)
update(1, 1, n, a, a, b);
else
g << query(1, 1, n, a, b) << '\n';
}
f.close();
g.close();
return 0;
}