#include using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() const int mod=1000000007,MAX=1<<21,INF=1<<30; template struct SegmentTree{ using F=function; int n; vector dat; F f; T ti; SegmentTree(int n_ ,F f ,T ti) :f(f),ti(ti){ n=1; while(n &v ,F f,T ti) :f(f),ti(ti){ n=1; while(n=0;i--) dat[i]=f(dat[i*2+1],dat[i*2+2]); } void update(int k,T x){ k+=n-1; dat[k]=x; while(k){ k=(k-1)/2; dat[k]=f(dat[k*2+1],dat[k*2+2]); } } T query_(int a,int b,int k,int l,int r){ if(r<=a||b<=l) return ti; if(a<=l&&r<=b) return dat[k]; else{ T vl=query_(a,b,2*k+1,l,(l+r)/2); T vr=query_(a,b,2*k+2,(l+r)/2,r); return f(vl,vr); } } T query(int a,int b){ return query_(a,b,0,0,n); } T get(int k){ return dat[k+n-1]; } }; int main(){ int N,Q;cin>>N>>Q; vector> A(N); for(int i=0;i>A[i].first; A[i].second=i+1; } SegmentTree> seg(N,A,[](pair a,pair b){return min(a,b);},{INF,0}); while(Q){ int c,x,y;cin>>c>>x>>y; x--;y--; if(c==1){ auto l=seg.get(x),r=seg.get(y); seg.update(x,{r.first,x+1}); seg.update(y,{l.first,y+1}); }else cout<