#include #include #include using namespace std; using ll = long long; ll n,mx = 100000000000000; pair t[200010]; void built(){ for(int i = n-1;i>0;i--){ t[i] = min(t[i<<1],t[i<<1|1]); } } void update(ll p,ll a){ for(t[p+=n].first = a;p>1;p >>= 1){ t[p>>1] = min(t[p],t[p^1]); } } pair query(int l, int r){ pair mn = {mx,-1}; for(l += n, r += n; l>= 1,r >>= 1){ if(l&1) mn = min(mn,t[l++]); if(r&1) mn = min(mn,t[--r]); } return mn; } int main(){ int i,q; cin >> n >> q; for(i=0;i> a; t[i + n] = {a,i + 1}; } built(); for(i=0;i> a >> b >> c; b--; c--; if(a==1){ int x = t[b + n].first,y = t[c + n].first; update(c,x); update(b,y); }else{ cout << query(b,c + 1).second << endl; } } }