#include<cstdio>
const int N=1<<18;
int a,b,t[N],x;
inline int max(int x,int y)
{
return x>y ? x : y;
}
void update(int poz,int st,int dr)
{
if(a<=st && dr<=b)
{
t[poz]=x;
return;
}
int mid=(st+dr)>>1;
if(a<=mid)
update(poz<<1,st,mid);
if(b>mid)
update((poz<<1)+1,mid+1,dr);
t[poz]=max(t[poz<<1],t[(poz<<1)+1]);
}
int query(int poz,int st,int dr)
{
if(a<=st && dr<=b)
return t[poz];
int mid=(st+dr)>>1,rez=-1;
if(a<=mid)
rez=max(rez,query(poz<<1,st,mid));
if(b>mid)
rez=max(rez,query((poz<<1)+1,mid+1,dr));
return rez;
}
int main()
{
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
int i,m,n,tip;
scanf("%d%d",&n,&m);
for(i=1;i<=n;++i)
{
scanf("%d",&x);
a=b=i;
update(1,1,n);
}
while(m--)
{
scanf("%d",&tip);
if(tip)
{
scanf("%d%d",&i,&x);
a=b=i;
update(1,1,n);
}
else
{
scanf("%d%d",&a,&b);
printf("%d\n",query(1,1,n));
}
}
return 0;
}