import java.util.ArrayList; import java.util.Scanner; public class Main { public static int arrayMax(int[] a){ int ret = 0; for(int i = 0; i < a.length; i++){ ret = Math.max(a[i],ret); } return ret; } public static void query(ArrayList> ans, int t, int p, int q, int[] a, int[] b){ ArrayList pro = new ArrayList<>(); pro.add(t); pro.add(p + 1); pro.add(q + 1); ans.add(pro); int temp = a[p] ^ b[q]; if(t == 1) a[p] = temp; else b[q] = temp; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int i = 0; i < n; i++) a[i] = sc.nextInt(); for(int i = 0;i < n; i++) b[i] = sc.nextInt(); int MAX = Math.max(arrayMax(a), arrayMax(b)); ArrayList> ans = new ArrayList<>(); int ind = 0; int inbflag = -1; for(int i = 0; i < n; i++) if (b[i] == MAX) inbflag = i; if (inbflag == -1){ for(int i = 0;i < n; i++){ if (a[i] == MAX){ ind = i; break; } } } else{ ind = 0; query(ans, 1, ind, inbflag, a, b); query(ans, 2, ind, inbflag, a, b); query(ans, 1, ind, inbflag, a, b); } int now = 1; for(int i = 0; i < 30; i++){ if (now <= MAX && 2 * now > MAX) break; now *= 2; } for(int i = 0; i < n; i++){ if (b[i] < now) query(ans, 2, ind, i, a, b); } for(int i = 0; i < n; i++){ if (a[i] >= now) query(ans, 1, ind, i, a, b); } System.out.println(ans.size()); for(int i = 0; i < ans.size(); i++){ ArrayList foo = ans.get(i); int t = foo.get(0); int p = foo.get(1); int q = foo.get(2); System.out.printf("%d %d %d\n",t, p, q); } } }