program arbint;
type tabel=array[0..100001] of longint;
var arb:tabel;
n,m,i,j,x,y,tip:longint;
f1,f2:text;
function max(a,b:longint):longint;
begin
if a>b then max:=a else max:=b;
end;
function query(nod,st,dr:longint):longint;
var m,maxx:longint;
begin
if (st>=x) and (dr<=y) then exit(arb[nod]) else
begin
m:=(st+dr) div 2; maxx:=0;
if x<=m then maxx:=max(maxx,query(nod*2,st,m));
if y>m then maxx:=max(maxx,query(nod*2+1,m+1,dr));
exit(maxx);
end; end;
procedure update(nod,st,dr:longint);
var m:longint;
begin
if st=dr then arb[nod]:=y else begin
m:=(st+dr) div 2;
if x<=m then update(nod*2,st,m) else
update(nod*2+1,m+1,dr);
arb[nod]:=max(arb[nod*2],arb[nod*2+1]);
end;
end;
begin
assign (f1,'arbint.in');
assign (f2,'arbint.out');
reset (f1);
rewrite (f2);
readln (f1,n,m);
for i:=1 to n do begin read (f1,y); x:=i; update(1,1,n); end;
for i:=1 to m do begin
readln (f1,tip,x,y);
if tip=0 then writeln (f2,query(1,1,n)) else
update(1,1,n);
end;
close (f1);
close (f2);
end.