class SegmentTree:
def __init__(self, data):
self.n = len(data)
self.tree = [0] * (2 * self.n)
self.build(data)
def build(self, data):
for i in range(self.n):
self.tree[self.n + i] = data[i]
for i in range(self.n - 1, 0, -1):
self.tree[i] = min(self.tree[2 * i], self.tree[2 * i + 1])
def update(self, index, value):
index += self.n
self.tree[index] = value
while index > 1:
index //= 2
self.tree[index] = min(self.tree[2 * index], self.tree[2 * index + 1])
def query(self, left, right):
result = float('inf')
left += self.n
right += self.n + 1
while left < right:
if left % 2 == 1:
result = min(result, self.tree[left])
left += 1
if right % 2 == 1:
right -= 1
result = min(result, self.tree[right])
left //= 2
right //= 2
return result
n, q = map(int, input().split())
data = list(map(int, input().split()))
seg_tree = SegmentTree(data)
for _ in range(q):
query = list(map(int, input().split()))
if query[0] == 1:
k, u = query[1] - 1, query[2]
seg_tree.update(k, u)
elif query[0] == 2:
a, b = query[1] - 1, query[2] - 1
print(seg_tree.query(a, b))