#include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF 11000000000 #define MOD 1000000007 typedef long long ll; typedef pair P; const int MAX_N=1<<17; //セグメント木を持つグローバル配列 int n,C[110000]; ll dat[2*MAX_N-1]; //初期化 void init(int n_){ //簡単のために要素数を2のべき乗に n=1; while(n0){ k=(k-1)/2; dat[k]=min(dat[k*2+1],dat[k*2+2]); } } //[a,b)の最小値を求める //後ろの方の引数は、計算の簡単のための引数 //kは接点の番号、l,rはその接点が[l,r)に対応づいていることを表す //したがって、外からはquery(a,b,0,0,n)として呼ぶ ll query(int a,int b,int k,int l,int r){ //cout<>N>>Q; init(N); for(int i=0;i>a; C[a]=i; update(i,a); } for(int i=0;i>com>>l>>r; l--;r--; if(com==1){ a=dat[l+n-1]; swap(C[a],C[dat[r+n-1]]); update(l,dat[r+n-1]); update(r,a); }else{ a=query(l,r+1,0,0,n); cout<