N=int(input()) A=[int(x) for x in input().split()] B=[int(x) for x in input().split()] d = len(bin(max(max(A),max(B))))-3 dA = [(a>>d)&1 for a in A] dB = [(a>>d)&1 for a in B] ans=[] if sum(dB)==0: a = dA.index(1) ans.append((2,a+1,1)) dB[0]=1 B[0]^=A[a] b = dB.index(1) for i in range(N): if dA[i]==1: ans.append((1,i+1,b+1)) dA[i]=0 A[i]^=B[b] ans.append((1,1,b+1)) A[0]^=B[b] dA[0]=1 for i in range(N): if dB[i]==0: ans.append((2,1,i+1)) dB[i]=1 B[i]^=A[0] ans.append((1,1,1)) print(len(ans)) [print(*a) for a in ans] A[0]^=B[0] dA[0]=0