#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a struct SegmentTree{ using F = function; int n; F f; T ti; vector dat; SegmentTree(){}; SegmentTree(F f,T ti):f(f),ti(ti){} void init(int n_){ n=1; while(n &v){ int n_=v.size(); init(n_); for(int i=0;i>=1) dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]); } T query(int a,int b){ T vl=ti,vr=ti; for(int l=a+n,r=b+n;l>=1,r>>=1) { if(l&1) vl=f(vl,dat[l++]); if(r&1) vr=f(dat[--r],vr); } return f(vl,vr); } }; struct FastIO{ FastIO(){ cin.tie(0); ios::sync_with_stdio(0); } }fastio_beet; //INSERT ABOVE HERE signed main(){ int n,q; cin>>n>>q; vector as(n); for(int i=0;i>as[i]; using P = pair; auto f=[](P a,P b){return min(a,b);}; const int INF = 1e9+1; P ti(INF,-1); SegmentTree

seg(f,ti); vector

vp(n); for(int i=0;i>t; if(t==1){ int l,r; cin>>l>>r; l--;r--; swap(as[l],as[r]); seg.set_val(l,P(as[l],l)); seg.set_val(r,P(as[r],r)); } if(t==2){ int l,r; cin>>l>>r; l--; cout<