operation=[] n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=[(a[i],i) for i in range(n)] d=[(b[i],i) for i in range(n)] c.sort(reverse=True) d.sort() for i in range(n): x,p=c[i] y,q=d[i] if x>y: operation.append((1,p,q)) operation.append((2,p,q)) operation.append((1,p,q)) a[p],b[q]=b[q],a[p] elif x==y: operation.append((1,p,q)) a[p]=0 mn=min(b) idx=b.index(mn) for i in range(n): if a[i]==mn: operation.append((1,i,idx)) print(len(operation)) for t,p,q in operation: print(t,p+1,q+1)