#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define int cpp_int
#define int long long
#define ull unsigned long long
#define EPS 1e-9
#define test_case \
int t; \
cin >> t; \
while (t--)
#define print_case cout << "Case " << ++cas << ": "
#define mod (int) 1e9+7
const int N = 1e5+7;
const int INF = INT64_MAX;
using namespace std;
int a[4*N], sol[4*N];
void make_seg_tree(int node, int b, int e) {
if(b==e) {
a[node] = sol[b]; return;
}
int mid = (b + e) >> 1, left = node * 2, right = (node * 2) + 1;
make_seg_tree(left, b, mid);
make_seg_tree(right, mid+1, e);
a[node] = min(a[left], a[right]);
}
void upd(int node, int b, int e, int ind, int value) {
if(ind > e or ind < b) return;
if(b == e and b == ind) {
a [node] = value;
return;
}
int l = node * 2, r =2 * node + 1;
int mid = (b + e) >> 1;
upd(l, b, mid, ind, value);
upd(r, mid+1, e, ind, value);
a[node] = min(a[l], a[r]);
}
int gen_output(int node, int b, int e, int i, int j) {
if(i>e or j<b) return INF;
if(b>=i and e<=j) return a[node];
int left = node * 2, right = (node * 2) + 1;
int mid = b + e >> 1;
int l = gen_output(left, b, mid, i, j);
int r = gen_output (right, mid+1, e, i, j);
return min(l, r);
}
void solve() {
int n, m; cin >> n >> m;
for(int i=1; i<=n; i++) cin >> sol[i];
make_seg_tree(1, 1, n);
while(m--) {
int typ; cin >> typ;
if(typ == 1) {
int ind, value; cin >> ind >> value;
upd(1, 1, n, ind+1, value);
}
else {
int i, j; cin >> i >> j;
cout << gen_output(1, 1, n, i+1, j)<<'\n';
}
}
}
int32_t main()
{
ios::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
// test_case
solve(),
cout<<'\n';
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Ci8vICNpbmNsdWRlIDxib29zdC9tdWx0aXByZWNpc2lvbi9jcHBfaW50LmhwcD4KIAov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bm9kZSAqIDIsIHIgPTIgKiBub2RlICArIDE7CiAgaW50IG1pZCA9IChiICsgZSkgPj4gMTsKICB1cGQobCwgYiwgbWlkLCBpbmQsIHZhbHVlKTsKICB1cGQociwgbWlkKzEsIGUsIGluZCwgdmFsdWUpOwogIGFbbm9kZV0gPSBtaW4oYVtsXSwgYVtyXSk7Cn0KaW50IGdlbl9vdXRwdXQoaW50IG5vZGUsIGludCBiLCBpbnQgZSwgaW50IGksIGludCBqKSB7CiAgaWYoaT5lIG9yIGo8YikgcmV0dXJuIElORjsKICBpZihiPj1pIGFuZCBlPD1qKSByZXR1cm4gYVtub2RlXTsKICBpbnQgbGVmdCA9IG5vZGUgKiAyLCByaWdodCA9IChub2RlICogMikgKyAxOwogIGludCBtaWQgPSBiICsgZSA+PiAxOwogIGludCBsID0gZ2VuX291dHB1dChsZWZ0LCBiLCBtaWQsIGksIGopOwogIGludCByID0gZ2VuX291dHB1dCAocmlnaHQsIG1pZCsxLCBlLCBpLCBqKTsKICByZXR1cm4gbWluKGwsIHIpOwoKfQp2b2lkIHNvbHZlKCkgewogICAgaW50IG4sIG07IGNpbiA+PiBuID4+IG07CiAgICBmb3IoaW50IGk9MTsgaTw9bjsgaSsrKSBjaW4gPj4gc29sW2ldOwogICAgbWFrZV9zZWdfdHJlZSgxLCAxLCBuKTsKICAgIHdoaWxlKG0tLSkgewogICAgICBpbnQgdHlwOyBjaW4gPj4gdHlwOwogICAgICBpZih0eXAgPT0gMSkgewogICAgICAgICAgaW50IGluZCwgdmFsdWU7IGNpbiA+PiBpbmQgPj4gdmFsdWU7CiAgICAgICAgICB1cGQoMSwgMSwgbiwgaW5kKzEsIHZhbHVlKTsKICAgICAgfQogICAgICBlbHNlIHsKICAgICAgICAgaW50IGksIGo7IGNpbiA+PiBpID4+IGo7CiAgICAgICAgIGNvdXQgPDwgZ2VuX291dHB1dCgxLCAxLCBuLCBpKzEsIGopPDwnXG4nOwogICAgICB9CiAgICB9Cn0KIAppbnQzMl90IG1haW4oKQp7CiAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogIGNpbi50aWUoTlVMTCksIGNvdXQudGllKE5VTEwpOwojaWZuZGVmIE9OTElORV9KVURHRQogICAgICBmcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKTsKICBmcmVvcGVuKCJvdXRwdXQudHh0IiwgInciLCBzdGRvdXQpOwojZW5kaWYKIC8vIHRlc3RfY2FzZQogIHNvbHZlKCksCiAgICAgIGNvdXQ8PCdcbic7CiAgcmV0dXJuIDA7Cn0=