#include<stdio.h>
#include<vector>
#define Nmax 100001
#define max(a,b) ((a>b) ? a:b)
using namespace std;
int i,N,x,M,y,type,Max,poz,val;
vector<int> H(4*Nmax);
void Update(int nod,int st,int dr)
{
if (st==dr)
{
H[nod]=val;
return;
}
int m=(st+dr)/2;
if (m>=poz) Update(2*nod,st,m);
else Update(2*nod+1,m+1,dr);
H[nod]=max(H[2*nod],H[2*nod+1]);
}
void Query(int nod,int st,int dr)
{
if (x<=st&&dr<=y)
{
Max=max(Max,H[nod]);
return;
}
int m=(st+dr)/2;
if (x<=m) Query(2*nod,st,m);
if (y>m) Query(2*nod+1,m+1,dr);
}
int main()
{
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf("%d%d",&N,&M);
for (i=1;i<=N;++i)
{
scanf("%d",&x);
poz=i;
val=x;
Update(1,1,N);
}
for (i=1;i<=M;++i)
{
scanf("%d%d%d",&type,&x,&y);
if (type==1)
{
poz=x;
val=y;
Update(1,1,N);
}
else
{
Max=0;
Query(1,1,N);
printf("%d\n",Max);
}
}
}