# include <stdio.h>
int arb[300000],n,m,i,nod,max,poz,x,a,b;
void ins (int nod, int st, int dr)
{
int m;
m=(st+dr)/2;
if (st==poz && dr==poz) arb[nod]=x;
else
{
if (poz<=m) ins (2*nod,st,m);
else ins (2*nod+1,m+1,dr);
if (arb[2*nod]>arb[2*nod+1]) arb[nod]=arb[2*nod];
else arb[nod]=arb[2*nod+1];
}
}
int caut (int nod, int st, int dr)
{
int m,p1,p2,mx;
p1=0;
p2=0;
if (a<=st && dr<=b) mx=arb[nod];
else
{
m=(st+dr)/2;
if (a<=m) p1=caut(2*nod,st,m);
if (b>m) p2=caut(2*nod+1,m+1,dr);
if (p1>p2) mx=p1;
else mx=p2;
}
return mx;
}
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;
ins(1,1,n);
}
for (i=1; i<=m; i++)
{
scanf ("%d %d %d",&x,&a,&b);
if (x==0)
{
max=caut (1,1,n);
printf ("%d\n",max);
}
else
{
poz=a;
x=b;
ins (1,1,n);
}
}
return 0;
}