N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) D=dict() for i in range(N): D[B[i]]=i ANS=[] for i in range(N): v=D.get(A[i],-1) if v>=0: ANS.append((1,i+1,v+1)) A[i]=0 while max(A)>min(B): X=A.index(max(A)) Y=B.index(min(B)) ANS.append((1,X+1,Y+1)) ANS.append((2,X+1,Y+1)) ANS.append((1,X+1,Y+1)) A[X]^=B[Y] B[Y]^=A[X] A[X]^=B[Y] print(len(ANS)) for i in range(len(ANS)): print(*ANS[i])