#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int N = 2e5+10;
int arr[N];
int segTree[4*N+1];
void buildSegTree(int idx, int low, int high){
if(low == high){
segTree[idx] = arr[low];
return;
}
int mid = (low + high) >> 1;
buildSegTree(2*idx, low, mid);
buildSegTree(2*idx+1, mid+1, high);
segTree[idx] = min(segTree[2*idx],segTree[2*idx+1]);
}
void updateSegTreePoint(int idx, int low, int high, int index, int val){
if(index<low or index>high){
return;
}
if(low == high){
segTree[idx] = val;
return;
}
int mid = (low+high)>>1;
if(index <= mid){
updateSegTreePoint(2*idx, low, mid, index, val);
} else {
updateSegTreePoint(2*idx+1, mid+1, high, index, val);
}
segTree[idx] = min(segTree[2*idx],segTree[2*idx+1]);
}
int querySegTree(int idx, int low, int high, int qs, int qe){
if(qs <= low and high <= qe){
return segTree[idx];
}
if(qe<low or qs>high or low>high){
return INT_MAX;
}
int mid = (low+high)>>1;
int left = querySegTree(2*idx, low, mid, qs, qe);
int right = querySegTree(2*idx+1, mid+1, high, qs, qe);
return min(left,right);
}
int32_t main() {
int n, q;
cin >> n >> q;
for(int i=0; i<n; i++){
cin>>arr[i];
}
buildSegTree(1, 0, n-1);
while(q--){
int t, a, b;
cin >> t >> a >> b;
if(t==1){
updateSegTreePoint(1, 0, n-1, a-1, b);
} else {
cout << querySegTree(1, 0, n-1, a-1, b-1) << endl;
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgaW50IGxvbmcgbG9uZyBpbnQKY29uc3QgaW50IE4gPSAyZTUrMTA7CgppbnQgYXJyW05dOwppbnQgc2VnVHJlZVs0Kk4rMV07Cgp2b2lkIGJ1aWxkU2VnVHJlZShpbnQgaWR4LCBpbnQgbG93LCBpbnQgaGlnaCl7CglpZihsb3cgPT0gaGlnaCl7CgkJc2VnVHJlZVtpZHhdID0gYXJyW2xvd107CgkJcmV0dXJuOwoJfQoJaW50IG1pZCA9I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