#include //#include //#include //#include #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i) #define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i) #define repl(i, a) for (ll i = (ll)0; i < (ll)a; ++i) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define popcount __builtin_popcount #define popcountll __builtin_popcountll #define fi first #define se second using ll = long long; constexpr ll mod = 1e9 + 7; constexpr ll mod_998244353 = 998244353; constexpr ll INF = 1LL << 60; // #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") //using lll=boost::multiprecision::cpp_int; //using Double=boost::multiprecision::number>;//仮数部が1024桁 template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } ll mypow(ll x, ll n, const ll &p = -1) { //x^nをmodで割った余り if (p != -1) { x =(x%p+p)%p; } ll ret = 1; while (n > 0) { if (n & 1) { if (p != -1) ret = (ret * x) % p; else ret *= x; } if (p != -1) x = (x * x) % p; else x *= x; n >>= 1; } return ret; } using namespace std; //using namespace atcoder; template class SegmentTree { using F = function; private: int n; vector v; const F f; const T e; public: SegmentTree(int _n, const F f, const T &e) : f(f),e(e) { n = 1; while (n < _n) n <<= 1; v = vector(2 * n, e); } void set(const int &k, const T &x) { v[k + n] = x; } void build() { //setが終わったら必ず呼ぶこと for (int i = n - 1; i > 0; --i) { v[i] = f(v[2 * i], v[2 * i + 1]); } } void update(int k, const T &x) { k += n; v[k] = x; while (k > 0) { k >>= 1; v[k] = f(v[2 * k], v[2 * k + 1]); } } T query(int a, int b) { T l = e, r = e; for (a += n, b += n; a < b; a >>= 1, b >>= 1) { if (a & 1) l = f(l, v[a++]); if (b & 1) r = f(v[--b], r); } return f(l, r); } T operator[](const int &k) { return v[k + n]; } template int find_subtree(int a, const C &check, T &M, bool type) { while (a < n) { T nxt = type ? f(v[2 * a + 1], M) : f(M, v[2 * a]); if (check(nxt)) a = 2 * a + type; else M = nxt, a = 2 * a + 1 - type; } return a - n; } template int find_first(int a, const C &check) { T L = e; if (a <= 0) { if (check(f(L, v[1]))) return find_subtree(1, check, L, false); return -1; } int b = n; for (a += n, b += n; a < b; a >>= 1, b >>= 1) { if (a & 1) { T nxt = f(L, v[a]); if (check(nxt)) return find_subtree(a, check, L, false); L = nxt; ++a; } } return -1; } template int find_last(int b, const C &check) { T R = e; if (b >= n) { if (check(f(v[1], R))) return find_subtree(1, check, R, true); return -1; } int a = n; for (b += n; a < b; a >>= 1, b >>= 1) { if (b & 1) { T nxt = f(v[--b], R); if (check(nxt)) return find_subtree(b, check, R, true); R = nxt; } } return -1; } }; void solve() { int n,q; cin>>n>>q; auto f=[](pair a,pair b)->pair{ if(a.first>seg(n,f,make_pair(inf,inf)); rep(i,n){ int a; cin>>a; seg.set(i,make_pair(a,i)); } seg.build(); while(q--){ int query,l,r; cin>>query>>l>>r; l--;r--; if(query==1){ int x=seg[l].first,y=seg[r].first; seg.update(l,make_pair(y,l)); seg.update(r,make_pair(x,r)); }else{ cout<