#include using namespace std; using ll = long long; using P = pair; using T = tuple; #define al(a) a.begin(), a.end() #define ral(a) a.rbegin(), a.rend() #define sz(a) (int)a.size() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define db(a, b) cout << #a << ": " << a << " " << #b << ": " << b << endl; #include using namespace atcoder; const int INF = 1001001001; P op(P a, P b) { return min(a, b); } P e() { return P(INF, INF); } int main() { int n, q; cin >> n >> q; vector

a(n); rep(i, n) { int na; cin >> na; a[i] = P(na, i + 1); } segtree seg(a); rep(qi, q) { int t, l, r; cin >> t >> l >> r; l--; if (t == 1) { auto x = seg.get(l); r--; auto y = seg.get(r); seg.set(l, P(y.first, x.second)); seg.set(r, P(x.first, y.second)); } else { auto [na, id] = seg.prod(l, r); cout << id << endl; } } return 0; }