import sys input = sys.stdin.readline def swap(i, j): global ans, A, B ans.append((1, i+1, j+1)) ans.append((2, j+1, i+1)) ans.append((1, i+1, j+1)) A[i], B[j] = B[j], A[i] N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = [] l = A+B l.sort() if l[N-1]==l[N]: x = l[N-1] if A.count(x)==l.count(x): for i in range(N): if A[i]==x: swap(i, 0) break elif B.count(x)==l.count(x): for i in range(N): if B[i]==x: swap(0, i) break for i in range(N): if B[i]==x: for j in range(N): if A[j]==x: ans.append((1, j+1, i+1)) A[j] = 0 break l = [] for i in range(N): l.append((A[i], i)) l.append((B[i], i+N)) l.sort() swap_a, swap_b = [], [] for _, i in l[:N]: if i>=N: swap_b.append(i-N) for _, i in l[N:]: if i