#include <stdio.h>
#include <ctype.h>
#define nmax 100000
#define arbint_max 262142
#define buff_size 1<<17
FILE *fin, *fout;
int v[nmax], aint[arbint_max], n, a, b, max, pozbuffr=buff_size, pozbuffw;
char buffr[buff_size], buffw[buff_size];
void scriech(){
}
void scrie( int nr ){
do{
scriech( nr%10 + '0' );
nr /= 10;
}while( nr!=0 );
}
char citirech(){
if( pozbuffr == buff_size ){
fread( buffr, buff_size, 1, fin );
pozbuffr = 0;
}
return buffr[pozbuffr++];
}
int citire (){
int nr = 0;
char ch = citirech();
while( isdigit(ch)==0 )
ch = citirech();
while( isdigit(ch)!=0 ){
nr = nr * 10 + ch - '0';
ch = citirech();
}
return nr;
}
int maxim( int a, int b ){
return (a >= b ) ? a : b;
}
void generare( int poz, int st, int dr ){
if( st==dr )
aint[poz] = v[st];
else{
int mij = ( st + dr ) / 2;
generare( poz*2, st, mij );
generare( poz*2+1, mij+1, dr );
aint[poz] = maxim( aint[poz*2], aint[poz*2+1] );
}
}
void cauta( int poz, int st, int dr ){
if( st>=a && dr<=b )
max = maxim( max, aint[poz] );
else{
int mij = ( st + dr ) / 2;
if( mij>=a )
cauta( poz*2, st, mij );
if( mij<b )
cauta( poz*2+1, mij+1, dr );
}
}
void update( int poz, int st, int dr ){
if( st==dr )
aint[poz] = b;
else{
int mij = ( st + dr ) / 2;
if( mij >= a ){
update( poz*2, st, mij );
aint[poz] = maxim( aint[poz*2], aint[poz*2+1] );
}
else{
update( poz*2+1, mij+1, dr );
aint[poz] = maxim( aint[poz*2], aint[poz*2+1] );
}
}
}
int main()
{
int m, i, ver;
fin = fopen( "arbint.in", "r" );
fout = fopen( "arbint.out", "w" );
n = citire();
m = citire();
for( i=1; i<=n; i++ )
v[i] = citire();
generare( 1, 1, n );
for( i=0; i<m; i++ ){
ver = citire();
a = citire();
b = citire();
if( ver==0 ){
max = 0;
cauta( 1, 1, n );
fprintf( fout, "%d\n", max );
}
else{
update( 1, 1, n );
}
}
fclose( fin );
fclose( fout );
return 0;
}