import sys
import threading
def main():
import sys
import math
input = sys.stdin.readline
n, q = map(int, sys.stdin.readline().split())
x = list(map(int, sys.stdin.readline().split()))
size = n
tree = [0] * (2 * size)
for i in range(n):
tree[size + i] = x[i]
for i in range(size - 1, 0, -1):
tree[i] = min(tree[2 * i], tree[2 * i + 1])
for _ in range(q):
while True:
s = sys.stdin.readline()
if s.strip():
break
parts = list(map(int, s.strip().split()))
if parts[0] == 1:
k, u = parts[1], parts[2]
k -= 1
i = k + size
tree[i] = u
i //= 2
while i >= 1:
tree[i] = min(tree[2 * i], tree[2 * i + 1])
i //= 2
else:
a, b = parts[1], parts[2]
a -= 1
l = a + size
r = b + size
res = float('inf')
while l < r:
if l % 2 == 1:
res = min(res, tree[l])
l += 1
if r % 2 == 1:
r -= 1
res = min(res, tree[r])
l //= 2
r //= 2
print(res)
threading.Thread(target=main).start()