#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include using namespace std; using Int = long long; typedef pair P; typedef pair Pl; const int mod = 1e9+7; #define END {cout< #define gPr(type) priority_queue,greater> #define V(type) vector #define rep(i,n) for(int i=0; i=int(l); i--) #define eb emplace_back #define pri1(a) cout< inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template struct SegTree{ V(T) buf; int s; const F f; const T g; SegTree(const V(T)& d,F ff,T gg):f(ff),g(gg){ int n=d.size(); s=1; while(s>=1)u(i); } T get(int b,int e,int l,int r,int i){ if(e<=l||r<=b)return g; if(b<=l&&r<=e)return buf[i]; int m=(l+r)/2; return f(get(b,e,l,m,i*2),get(b,e,m,r,i*2+1)); } T get(int b,int e){ return get(b,e,0,s,1); } T operator[](const int &k)const{ return buf[k+s]; } }; template SegTree segtree(const V(T)& d,F f,T g){ return SegTree(d,f,g); } int n,m,_,x,y,q,key; string s,sb; bool ok; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); cin>>n>>q; V(P) a(n); rep(i,n){cin>>x; a[i]=P(x,i+1);} auto seg=segtree(a,[](P x,P y){return min(x,y);},P(1e6,1e6)); //rep(i,n)prip(seg[i]); rep(i,q){ cin>>m>>x>>y; x--; if(m==2)pri1(seg.get(x,y).second); else{y--; swap(a[x].first,a[y].first); seg.set(x,a[x]); seg.set(y,a[y]);} } }