#include <bits/stdc++.h>
using namespace std;
ifstream f("aint.in");
ofstream g("aint.out");
const int N=100010;
struct nod
{
int val;
nod *fs,*fd;
nod(){val=0,fs=fd=NULL;}
nod(int val_){val=val_;fs=fd=NULL;}
nod(int val_,nod *fs_,nod *fd_){val=val_;fs=fs_;fd=fd_;}
};
nod *F[N],*root,*constr(int,int);
int n,m,i,a,b,c,ask(nod*,int,int);
void upd(nod*,int,int);
int main()
{
f>>n>>m;
for(i=1;i<=n;i++)
{
int x;f>>x;
F[i]=new nod;
*F[i]=nod(x);
}
root=constr(1,n);
for(;m;m--)
{
f>>c>>a>>b;
if(c)upd(root,1,n);
else g<<ask(root,1,n)<<'\n';
}
return 0;
}
nod *constr(int st,int dr)
{
int mi=(st+dr)/2;
if(st==dr)return F[st];
nod *aux;aux=new nod;
aux->fs=constr(st,mi);
aux->fd=constr(mi+1,dr);
aux->val=max(aux->fs->val,aux->fd->val);
return aux;
}
void upd(nod *nd,int lo,int hi)
{
if(lo==hi)
{
nd->val=b;
return ;
}
int mi=(lo+hi)/2;
if(a<=mi)upd(nd->fs,lo,mi);
else upd(nd->fd,mi+1,hi);
nd->val=max(nd->fs->val,nd->fd->val);
}
int ask(nod *nd,int lo,int hi)
{
if(b<lo||hi<a)return 0;
if(a<=lo&&hi<=b)return nd->val;
int mi=(lo+hi)/2;
return max(ask(nd->fs,lo,mi),ask(nd->fd,mi+1,hi));
}