#include using namespace std; using ll = long long; using PII = std::pair; using PLL = std::pair; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif int n, q, p, l, r; cin >> n >> q; vector rmq; rep(i, n) { cin >> p; rmq.push_back(p); } rep(i, q) { cin >> p >> l >> r; if(p == 1) swap(rmq[l-1], rmq[r-1]); else { auto k = min_element(rmq.begin() + l - 1, rmq.begin() + r); cout << distance(rmq.begin(), k) + 1 << endl; } } // for (auto z : rmq) // cout << z << " "; // cout << endl; return 0; }