#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include int ri() { int n; scanf("%d", &n); return n; } int main() { int n = ri(); int q = ri(); int a[n]; for (int i = 0; i < n; i++) a[i] = ri(); for (int i = 0; i < q; i++) { int t = ri(), l = ri() - 1, r = ri() - 1; if (t == 1) std::swap(a[l], a[r]); else printf("%d\n", (int)(std::min_element(a + l, a + r + 1) - a) + 1); } return 0; }