#include <stdio.h>
#include <stdlib.h>
#define MAX(a,b) (a>b)?a:b
int arbore[262145]; //simulez arbore complet
int n,m;
void update(int i,int st, int dr, int a,int b,int val)
{
if (a<=st && dr<=b)
arbore[i]=val;
else
{
int m=(st+dr)/2;
if (a<=m)
update(i*2,st,m,a,b,val);
if (m<b)
update(i*2+1,m+1,dr,a,b,val);
arbore[i]=MAX(arbore[i*2],arbore[i*2+1]);
}
}
int query (int i,int st, int dr, int a, int b)
{
if (a<=st && dr<=b)
return arbore[i];
else
{
int max1=0,max2=0;
int m=(st+dr)/2;
if (a<=m)
max1=query(i*2,st,m,a,b);
if (m<b)
max2=query(i*2+1,m+1,dr,a,b);
return MAX(max1,max2);
}
}
int main()
{
int i,t,a,b;
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf ("%d%d",&n,&m);
for (i=1;i<=n;i++)
{
scanf("%d",&a);
update(1,1,n,i,i,a);
}
for (i=0;i<m;i++)
{
scanf("%d%d%d",&t,&a,&b);
if (t==0)
printf("%d\n",query(1,1,n,a,b));
else
update(1,1,n,a,a,b);
}
return 0;
}