#include using namespace std; int a[100'004]; int tree[500'004]; void build(int l, int r, int ind) { if (l==r) { tree[ind]=a[l]; return; } int mid=(l+r)/2; build(l, mid, ind*2); build(mid+1, r, ind*2+1); tree[ind]=min(tree[ind*2], tree[ind*2+1]); return; } int mini(int l, int r, int ind, int ql, int qr) { if (ql<=l && r<=qr) { return tree[ind]; } if (rqr) return 1000000000; int mid=(l+r)/2; return min(mini(l, mid, ind*2, ql, qr), mini(mid+1, r, ind*2+1, ql, qr)); } void change(int l, int r, int ind, int pos, int x) { if (posr) return; if (l==pos && l==r) { tree[ind]=x; return; } int mid=(l+r)/2; change(l, mid, ind*2, pos, x); change(mid+1, r, ind*2+1, pos, x); tree[ind]=min(tree[ind*2], tree[ind*2+1]); return; } int main () { freopen("roads.in", "r", stdin); freopen("roads.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int q; cin>>q; for (int i=1; i>a[i]; } build(1, n-1, 1); for (int i=0; i>type>>ind>>x; if (type==1) { change(1, n-1, 1, ind, x); } else { int l=1; int r=ind-1; int ans1=ind; while (l<=r) { int mid=(l+r)/2; if (mini(1, n-1, 1, mid, ind-1)>=x) { ans1=mid; r=mid-1; } else { l=mid+1; } } l=ind; r=n-1; int ans2=ind; while (l<=r) { int mid=(l+r)/2; if (mini(1, n-1, 1, ind, mid)>=x) { ans2=mid+1; l=mid+1; } else { r=mid-1; } } //cout<