program arbori_de_intervale;
var f,g:text;
bufin,bufout:array[1..1 shl 17] of char;
n,m,i,x,poz,a,b,max:longint;
arb:array of longint;
//----------------------------------
function maxim(a, b:longint):longint;
begin
if a > b then maxim := a
else maxim := b;
end;
//---------------------------------
procedure update(nod, st, dr:longint);
var mij:longint;
begin
if st = dr then arb[nod] := x
else
begin
mij := (st + dr) div 2;
if poz <= mij then update(2*nod, st, mij)
else update(2*nod + 1, mij + 1, dr);
arb[nod] := maxim(arb[2*nod], arb[2*nod + 1]);
end;
end;
//--------------------------------
procedure search(nod, st, dr:longint);
var mij:longint;
begin
if (a <= st) and (dr <= b) then
begin
if max < arb[nod] then max := arb[nod];
end
else
begin
mij := (st + dr) div 2;
if (a <= mij) then search(2*nod, st, mij);
if (mij < b) then search(2*nod+1, mij+1, dr);
end;
end;
//---------------------------------
begin
assign(f,'arbint.in'); reset(f);
assign(g,'arbint.out'); rewrite(g);
settextbuf(f, bufin); settextbuf(f, bufout);
readln(f ,n, m);
setlength(arb, n+m+1);
for i := 1 to n do
begin
read(f, x); poz := i; update(1, 1, n);
end;
for i := 1 to m do
begin
readln(f, x, a, b);
if x = 0 then
begin
max := 0; search(1,1,n); writeln(g,max);
end
else
begin
poz := a; x := b; update(1,1,n);
end;
end;
close(f); close(g);
end.