#include <iostream>
#include <fstream>
using namespace std;
int v[4 * 100002];
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");
int n, q;
f >> n >> q;
for(int i = 1; i <= n; i++)
{
int x; f >> x;
update(1, 1, n, i, i, x);
}
while(q--)
{
int c, a, b; f >> c >> a >> b;
if(!c) g << query(1, 1, n, a, b) << '\n';
else update(1, 1, n, a, a, b);
}
f.close();
g.close();
return 0;
}