#include <cstdio>
#define max(x,y) (x<y)?y:x
int arb[400999],v[100009];
int n,m,x,y;
void init(int poz,int a,int b)
{
if (a==b) arb[poz]=v[a]; else
{
int c=(a+b)/2;
init(poz*2,a,c);
init(poz*2+1,c+1,b);
arb[poz]=max(arb[poz*2],arb[poz*2+1]);
}
}
int get(int poz, int a, int b)
{
int c=(a+b)/2;
if ((x<=a) && (y>=b)) return arb[poz];
if (y<=c) return get(poz*2,a,c);
if (x>c) return get(poz*2+1,c+1,b);
return max(get(poz*2,a,c),get(poz*2+1,c+1,b));
}
void update(int poz, int a , int b)
{
int c=(a+b)/2;
if ((a==x) && (b==x)) arb[poz]=y; else
{
if (x<=c) update(poz*2,a,c); else
update(poz*2+1,c+1,b);
arb[poz]=max(arb[poz*2],arb[poz*2+1]);
}
}
int main()
{
freopen("arbint.in","r",stdin);
freopen("arbint.out","w",stdout);
scanf("%d %d",&n,&m);
for (int i=1;i<=n;++i) scanf("%d",&v[i]);
init(1,1,n);
for (int i=1;i<=m;++i)
{
int op;
scanf("%d %d %d",&op,&x,&y);
if (op==0)
printf("%d\n",get(1,1,n)); else
update(1,1,n);
}
return 0;
}