import numpy as np def solve(): n, q = map(int, input().split()) A = np.asarray([0] + list(map(int, input().split()))) for _ in range(q): c, l, r = map(int, input().split()) if c == 1: A[l], A[r] = A[r], A[l] else: print(l + np.argmin(A[l:r + 1])) solve()