#include using namespace std; struct Tree{ int n; vector> vec; Tree(int _n){ n=1; while(n<_n){ n*=2; } vec.assign(n*2+10,{INT_MAX,INT_MAX}); } void set(int k,pair x){ vec[k+n]=x; } void build(){ for(int i=n-1;i>0;i--){ vec[i]=min(vec[i*2],vec[i*2+1]); } } void update(int k,pair x){ k+=n; vec[k]=x; k/=2; while(k){ vec[k]=min(vec[k*2],vec[k*2+1]); k/=2; } } void swap(int b,int c){ auto p=vec[b+n]; auto q=vec[c+n]; p.second=c+1; q.second=b+1; update(c,p); update(b,q); } int query(int l,int r){ l+=n; r+=n; pair ans={INT_MAX,INT_MAX}; while(l>n>>q; Tree tr(n); for(int i=0;i>t; tr.set(i,{t,i+1}); } tr.build(); for(int i=0;i>a>>b>>c; b--;c--; if(a==1){ tr.swap(b,c); }else{ cout<