#include <cstdio>
#include <algorithm>
using namespace std;
int arb[1<<19],op,x,a,b,n,m,i,poz;
void actualizare ( int nod, int st, int dr )
{ int m;
if(st>=poz && dr <=poz)
{
arb[nod]=x;
return;
}
m=(st+dr)/2;
if(poz<=m) actualizare ((nod<<1),st,m);
else actualizare ((nod<<1)+1,m+1,dr);
arb[nod]=max(arb[(nod<<1)], arb[(nod<<1)+1]);
}
int interogare(int nod, int st, int dr)
{
int x1=0,x2=0;
if(a<=st && b>=dr)
{
return arb[nod];
}
int m=(st+dr)/2;
if(a<=m)
{
x1=interogare(nod<<1,st,m);
}
if(b>m)
{
x2=interogare((nod<<1)+1,m+1,dr);
}
return max(x1,x2);
}
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",&op,&a,&b);
if(op==0) printf("%d\n",interogare(1,1,n));
else
{
poz=a;
x=b;
actualizare(1,1,n);
}
}
return 0;
}