import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int[] countsA = new int[n]; int maxA = 0; int aIdx = 0; for (int i = 0; i < n; i++) { countsA[i] = getCount(sc.nextInt()); if (maxA < countsA[i]) { maxA = countsA[i]; aIdx = i; } } int[] countsB = new int[n]; int maxB = 0; int bIdx = 0; for (int i = 0; i < n; i++) { countsB[i] = getCount(sc.nextInt()); if (maxB < countsB[i]) { maxB = countsB[i]; bIdx = i; } } int ans = 0; StringBuilder sb = new StringBuilder(); if (maxA < maxB) { sb.append("1 1 ").append(bIdx + 1).append("\n"); ans++; maxA = maxB; aIdx = 0; countsA[0] = maxB; } for (int i = 0; i < n; i++) { if (countsB[i] < maxA) { sb.append("2 ").append(aIdx + 1).append(" ").append(i + 1).append("\n"); ans++; } } for (int i = 0; i < n; i++) { if (countsA[i] == maxA) { sb.append("1 ").append(i + 1).append(" 1\n"); ans++; } } System.out.println(ans); System.out.print(sb); } static int getCount(int x) { int count = 0; while (x > 0) { count++; x >>= 1; } return count; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }