#include<stdio.h>
int n,m,v[100000*3],maxint,x,y;
inline int max(int a,int b){return a>b?a:b;}
void update(int nod,int st,int dr){
if(st==dr){
v[nod]=y;
return;
}else{
int mid=(st+dr)/2;
if(x<=mid)
update(nod*2,st,mid);
else
update(nod*2+1,mid+1,dr);
v[nod]=max(v[nod*2],v[nod*2+1]);
}
}
void query(int nod,int st,int dr){
if(x<=st && dr<=y){
maxint=max(maxint,v[nod]);
return;
}
int mid=(st+dr)/2;
if(x<=mid)
query(nod*2,st,mid);
if(y>mid)
query(nod*2+1,mid+1,dr);
}
int main(){
int code;
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf("%d %d\n",&n,&m);
for(x=1;x<=n;x++){
scanf("%d",&y);
update(1,1,n);
}
while(m--){
scanf("%d %d %d\n",&code,&x,&y);
if(code)
update(1,1,n);
else{
maxint=0;
query(1,1,n);
printf("%d\n",maxint);
}
}
return 0;
}