def swap(p,q): # A_p と B_q を swap operation.append((1,p,q)) operation.append((2,p,q)) operation.append((1,p,q)) a[p],b[q]=b[q],a[p] def swapA(i,j): # A_i と A_j を swap swap(i,0) swap(j,0) swap(i,0) n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) operation=[] mx=0 id='A' id2=0 for i in range(n): if a[i]>mx: mx=a[i] id='A' id2=i if b[i]>mx: mx=b[i] id='B' id2=i # A_0 = mx となるようにする if id=='A': if id2!=0: swapA(0,id2) else: swap(0,id2) max_bit=len(bin(mx))-3 for i in range(n): if (b[i]>>max_bit)&1==0: operation.append((2,0,i)) b[i]=b[i]^a[0] for i in range(n): if (a[i]>>max_bit)&1==1: operation.append((1,i,0)) a[i]=a[i]^b[0] print(len(operation)) for t,p,q in operation: print(t,p+1,q+1)