import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int N = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; int[] x = new int[N]; int[] y = new int[N]; int xmax = -1; int ymax = -1; int p = 0; int q = 0; LinkedList que = new LinkedList<>(); for( int i = 0; i < N; i++ ) { a[i] = sc.nextInt(); while( (a[i]>>x[i]) > 0 ) x[i]++; xmax = Math.max(xmax,x[i]); } for( int i = 0; i < N; i++ ) { b[i] = sc.nextInt(); while( (b[i]>>y[i]) > 0 ) y[i]++; ymax = Math.max(ymax,y[i]); } if( xmax >= ymax ) { for( int i = 0; i < N; i++ ) { if( x[i] == xmax ) p = i; } for( q = 0; q < N; q++ ) { if( y[q] < x[p] ) { b[q] = a[p]^b[q]; que.offer(new Tuple(2,p+1,q+1)); } } for( p = 0; p < N; p++ ) { if( x[p] == xmax ) { a[p] = a[p]^b[0]; que.offer(new Tuple(1,p+1,1)); } } }else { for( int i = 0; i < N; i++ ) { if( y[i] == ymax ) q = i; } que.offer(new Tuple(1,1,q+1)); a[0] = a[0]^b[q]; for( q = 0; q < N; q++ ) { if( y[q] < ymax ) { b[q] = a[0]^b[q]; que.offer(new Tuple(2,1,q+1)); } } que.offer(new Tuple(1,1,1)); a[0] = a[0]^b[0]; } pw.println(que.size()); for( Tuple t : que ) { pw.println(t.a+" "+t.b+" "+t.c); } pw.flush(); } } class Tuple { int a, b, c; public Tuple(int a, int b, int c) { this.a = a; this.b = b; this.c = c; } }