import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Random;
import java.util.Scanner;

public class stress {
	static PrintWriter out;
	static Random rand = new Random(213453);

	public static void main(String[] args) throws FileNotFoundException {
		int test = 0;
		while (true) {
			test++;
			if (test % 10 == 0) {
				System.out.println(test);
			}
			out = new PrintWriter("pinetree.in");
			randomNotSoBigTree(13);
			out.close();
			pinetree_aa.main(new String[0]);
			Scanner in1 = new Scanner(new File("pinetree.out"));
			int ans1 = in1.nextInt();
			in1.close();
			pinetree_sm.main(new String[0]);
			Scanner in2 = new Scanner(new File("pinetree.out"));
			int ans2 = in2.nextInt();
			in2.close();
			if (ans1 != ans2) {
				break;
			}
		}
	}

	private static void randomNotSoBigTree(int n) {
		int[] a = new int[n];
		a[0] = -1;
		for (int i = 1; i < a.length; i++) {
			a[i] = rand.nextInt(i);
		}
		int[] perm = randPerm(n);
		out.println(n);
		for (int i = 1; i < a.length; i++) {
			out.println((perm[i] + 1) + " " + (perm[a[i]] + 1));
		}
	}

	private static int[] randPerm(int n) {
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = i;
			int j = rand.nextInt(i + 1);
			int tmp = a[i];
			a[i] = a[j];
			a[j] = tmp;
		}
		return a;
	}

}
