def solve(n, a, b): ans = [] c = sorted(a + b) minb = c[n] if c.count(minb) > 1 and minb not in a: p = a.index(max(a)) q = b.index(minb) ans.append((1, p + 1, q + 1)) ans.append((2, p + 1, q + 1)) ans.append((1, p + 1, q + 1)) a[p], b[q] = b[q], a[p] if c.count(minb) > 1 and minb not in b: p = a.index(minb) q = b.index(min(b)) ans.append((1, p + 1, q + 1)) ans.append((2, p + 1, q + 1)) ans.append((1, p + 1, q + 1)) a[p], b[q] = b[q], a[p] while a.count(minb) + b.count(minb) > 1: if b.count(minb) >= 1: p = a.index(minb) q = b.index(minb) ans.append((2, p + 1, q + 1)) b[q] = 0 elif a.count(minb) > 1: p = a.index(minb) q = b.index(minb) ans.append((1, p + 1, q + 1)) a[q] = 0 while max(a) > min(b): p = a.index(max(a)) q = b.index(min(b)) if min(b) == 0: ans.append((1, p + 1, q + 1)) ans.append((2, p + 1, q + 1)) a[p], b[q] = b[q], a[p] else: ans.append((1, p + 1, q + 1)) ans.append((2, p + 1, q + 1)) ans.append((1, p + 1, q + 1)) a[p], b[q] = b[q], a[p] return ans n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) ans = solve(n, a, b) print(len(ans)) for t, i, j in ans: print(t, i, j)