#include <cstdio>
using namespace std;
int a,b,arb[1<<19],x,poz,i,nr,n,m;
inline int interogare(int nod, int st, int dr)
{
int m,x1,x2;
x1=x2=0;
if (a<=st && dr<=b) return arb[nod];
m=(st+dr)/2;
if (a<=m) x1=interogare(nod*2,st,m);
if (m<b) x2=interogare(nod*2+1,m+1,dr);
if (x1<x2) x1=x2;
return x1;
}
inline void actualizare(int nod, int st, int dr)
{
int m;
if (st>=poz && poz>=dr) {arb[nod]=x;return;}
m=(st+dr)/2;
if (poz<=m) actualizare(nod*2,st,m); else actualizare(nod*2+1,m+1,dr);
if (arb[nod*2]<arb[nod*2+1]) arb[nod]=arb[nod*2+1]; else arb[nod]=arb[nod*2];
}
int main()
{
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf("%d%d",&n,&m);
for (i=1;i<=n;i++)
{
scanf("%d",&x);
poz=i;
actualizare(1,1,n);
}
for (i=1;i<=m;i++)
{
scanf("%d%d%d",&nr,&a,&b);
if (nr==0) printf("%d\n",interogare(1,1,n));
else
{
poz=a;
x=b;
actualizare(1,1,n);
}
}
return 0;
}