#include using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) #define reps(i,n) for(ll i=1;i<=(n);++i) using ll = long long; using str = string; constexpr long long INF = (1LL<<60); constexpr long long MOD = (1e9+7); templateinline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));} templateinline T lcm(T a,T b){return a/gcd(a,b)*b;} templateinline bool chmax(T &a,const T &b){if(ainline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} inline void dump(){cout<inline void dump(Head&& head, Tail&&... tail){cout<(tail)...);} templateinline istream &operator>>(istream&input,vector&v){for(auto &elemnt:v)input>>elemnt;return input;} // usi tree class Segment_Tree { private: ll n=1; using P=pair; P init = P(INF,0); std::vector

node; P f(P x,P y){ return x.first v){ ll sz = ((ll)v.size()); while(n=0;--i)node[i]=f(node[i*2+1],node[i*2+2]); } void update(ll idx,ll x){ idx+=n-1; node[idx].first=x; while(idx){ idx--;idx>>=1; node[idx]=f(node[idx*2+1],node[idx*2+2]); } } void swap(ll l,ll r){ auto tmp=node[l+n-1].first; node[l+n-1].first=node[r+n-1].first; node[r+n-1].first=tmp; l+=n-1; r+=n-1; while(l){ l--;l>>=1; node[l]=f(node[l*2+1],node[l*2+2]); } while(r){ r--;r>>=1; node[r]=f(node[r*2+1],node[2*r+2]); } } auto query(ll a,ll b,ll k=0,ll l=0,ll r=-1){ if(r<0)r=n; if(r<=a || b<=l)return init; if(a<=l && r<=b)return node[k]; else{ auto vl = query(a,b,2*k+1,l,(l+r)/2); auto vr = query(a,b,2*k+2,(l+r)/2,r); return f(vl,vr); } } void dump(){ for(auto i:node)cout<>n>>q; vector a(n); cin>>a; Segment_Tree seg(a); rep(i,q){ ll x,l,r; cin>>x>>l>>r; l--;r--; if(x==1){ seg.swap(l,r); } else{ auto tmp=seg.query(l,r+1); cout<