#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 *root,*constr(int,int);
int n,m,i,a,b,c,v[N],ask(nod*,int,int);
void upd(nod*,int,int);
int main()
{
f>>n>>m;
for(i=1;i<=n;i++)
f>>v[i];
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;nod *aux;aux=new nod;
if(st==dr){aux->val=v[st],aux->fs=aux->fd=NULL;return aux;}
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));
}