def dyn_range_mn_queries(n, q, arr, barr):
tree = [0] * (4 * n)
def build(node, start, end):
if start == end:
tree[node] = arr[start]
else:
mid = (start + end) // 2
build(2 * node + 1, start, mid)
build(2 * node + 2, mid + 1, end)
tree[node] = min(tree[2 * node + 1], tree[2 * node + 2])
def update(node, start, end, idx, val):
if start == end:
tree[node] = val
else:
mid = (start + end) // 2
if start <= idx <= mid:
update(2 * node + 1, start, mid, idx, val)
else:
update(2 * node + 2, mid + 1, end, idx, val)
tree[node] = min(tree[2 * node + 1], tree[2 * node + 2])
def query_tree(node, start, end, l, r):
if r < start or end < l:
return float('inf')
if l <= start and end <= r:
return tree[node]
mid = (start + end) // 2
left_min = query_tree(2 * node + 1, start, mid, l, r)
right_min = query_tree(2 * node + 2, mid + 1, end, l, r)
return min(left_min, right_min)
build(0, 0, n - 1)
for query in barr:
if query[0] == 1:
_, k, u = query
update(0, 0, n - 1, k - 1, u)
else:
_, a, b = query
result = query_tree(0, 0, n - 1, a - 1, b - 1)
print(result)
n, q = map(int, input().split())
arr = list(map(int, input().split()))
barr = []
for _ in range(q):
query = list(map(int, input().split()))
barr.append(query)
dyn_range_mn_queries(n, q, arr, barr)
# Input:
# 8 4
# 3 2 4 5 1 1 5 3
# 2 1 4
# 2 5 6
# 1 2 3
# 2 1 4
# Output:
# 2
# 1
# 3