// I SELL YOU...! #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using P = pair; using TP = tuple; void init_io(){ cin.tie(0); ios::sync_with_stdio(false); cout << setprecision(18); } template struct SegmentTree{ using F = function< Monoid(Monoid,Monoid) >; int sz; vector seg; const F f; const Monoid M; SegmentTree(int n,const F f,const Monoid &M) : f(f),M(M){ sz = 1; while(sz0;k--){ seg[k] = f(seg[2*k],seg[2*k+1]); } } void update(int k,const Monoid &v){ k += sz; seg[k] = v; while(k >>= 1){ seg[k] = f(seg[2*k],seg[2*k+1]); } } Monoid que(int a,int b){ Monoid L=M,R=M; for(a+=sz, b+=sz;a>=1,b>>=1){ if(a&1) L = f(L,seg[a++]); if(b&1) R = f(seg[--b],R); } return f(L,R); } Monoid operator[](const int &k) const{ return seg[k+sz]; } }; signed main(){ init_io(); ll n,q,a,p,l,r; cin >> n >> q; SegmentTree

seg(n,[](P a,P b){ return min(a,b); },P(11110000000,0)); for(ll i=0;i> a; seg.update(i,P(a,i)); } for(int i=0;i> p >> l >> r; l--; r--; if(p==1){ ll x = seg[l].first; ll y = seg[r].first; seg.update(l,P(y,l)); seg.update(r,P(x,r)); }else{ cout << seg.que(l,r+1).second+1<