n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) MAX = max(max(a), max(b)) ans = [] if a[0] == MAX: pass elif MAX in b: p = 0 q = b.index(MAX) 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] elif MAX in a: p = a.index(MAX) q = 0 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] p = 0 q = 0 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] k = len(bin(MAX)) - 2 d = 2 ** (k - 1) for i in range(n): if b[i] < d: ans.append((2, 1, i + 1)) b[i] = a[0] ^ b[i] for i in range(n): if a[i] >= d: ans.append((1, i + 1, 1)) a[i] = a[i] ^ b[0] print(len(ans)) for v in ans: print(*v)