#include using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair; #define INF INT_MAX #define MOD 1000000007 #define rng(a) a.begin(),a.end() #define rrng(a) a.end(),a.begin() struct Seg{ vectornode; int treesz; int vsz; Seg(vectorv){ int n=v.size(); vsz=1;while(vsz=0;i--)node[i]=min(node[2*i+1],node[2*i+2]); } pii operator[](int i){ return node[vsz-1+i]; } void update(int x,int i){ node[vsz-1+i]={x,i}; i+=vsz-1; while(i>0){ i=(i-1)/2; node[i]=min(node[2*i+1],node[2*i+2]); } } pii getmin(int a,int b,int k=0,int l=0,int r=-1){ if(r<0)r=vsz; if(r<=a||b<=l)return {INF,0}; if(a<=l&&r<=b)return node[k]; pii lv=getmin(a,b,2*k+1,l,(r+l)/2); pii rv=getmin(a,b,2*k+2,(r+l)/2,r); return min(lv,rv); } }; int main(){ ios::sync_with_stdio(false); cin.tie(0); int N,Q; cin>>N>>Q; vectora(N); for(int i=0;i>a[i]; Seg seg(a); for(int i=0;i>n>>l>>r; if(n==1){ int lmemo=seg[l-1].first; int rmemo=seg[r-1].first; seg.update(rmemo,l-1); seg.update(lmemo,r-1); } if(n==2){ pii ans=seg.getmin(l-1,r); cout<