mod = 998244353 def main(): import sys input = sys.stdin.readline N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = [] max_bit = 0 for a in A: max_bit = max(max_bit, a.bit_length() - 1) for b in B: max_bit = max(max_bit, b.bit_length() - 1) for j, b in enumerate(B): if b >> max_bit & 1: if A[0] >> max_bit & 1 == 0: ans.append((1, 1, j)) A[0] ^= b if A[0] >> max_bit & 1: ii = 0 else: for i, a in enumerate(A): if a >> max_bit & 1: ii = i break for j, b in enumerate(B): if b >> max_bit & 1 == 0: ans.append((2, ii + 1, j)) B[j] ^= A[ii] for i, a in enumerate(A): if a >> max_bit & 1: ans.append((1, i, 1)) A[i] ^= B[0] assert max(A) < min(B) print(len(ans)) for line in ans: print(*line) if __name__ == '__main__': main()