// Arhiva educationala - Arbori de intervale
var
n, m, i2, i, t, a, b, poz, val : longint;
v : array[1..400100] of longint;
s : array[1..1000000] of char;
f, g : text;
function query (nod, st, dr : longint) : longint;
var
m1, m2, mij, t : longint;
begin
if (poz <= st) and (dr <= val) then
begin
query := v[nod]; exit
end;
mij := (st+dr) shr 1; m1 := 0; m2 := 0;
t := nod shl 1;
if (poz <= mij) then
m1 := query (t, st, mij);
if (mij < val) then
m2 := query (t + 1, mij+1, dr);
if (m1 >= m2) then query := m1 else query := m2;
end;
procedure update (nod, st, dr : longint);
var
mij, t: longint;
begin
if (st = poz) and (dr = poz) then
begin v[nod] := val; exit; end;
mij := (st + dr) shr 1;
t := nod shl 1;
if (poz <= mij) then
update (t, st, mij)
else
update (t + 1, mij+1, dr);
if (v[t] >= v[t+1]) then v[nod] := v[t] else v[nod] := v[t+1];
end;
begin
assign (f, 'arbint.in'); assign (g, 'arbint.out');
reset (f); rewrite (g);
readln (f, n, m);
read (f, s);
i:=1; poz:= 0;
while (s[i] <> #0) do
begin
a := 0; inc(poz);
while (s[i] <> #0) and (s[i]<>#32) do
begin
a := a*10+ord(s[i])-48;
inc(i);
end;
update (1, 1, n);
inc(i);
end;
readln (f);
for i := 1 to m do
begin
readln (f, t, poz, val);
if (t = 1) then
update (1, 1, n)
else
writeln (g, query (1, 1, n));
end;
close (f); close (g);
end.