import java.io.*;
import java.util.*;

public class wires_gen {

	public static void main(String[] args) {
		Random rand = new Random(255666);
		for (int test = 0; test < 25; test++) {
			try {
				PrintWriter out = new PrintWriter((test + 1 < 10 ? "0" : "")
						+ (test + 1));
				switch (test) {
				case 0:
					out.println("2");
					out.println("1 4");
					out.println("6 8");
					break;
				case 1:
					out.println("2");
					out.println("1 4");
					out.println("2 5");
					break;
				case 2:
					out.println("1");
					out.println("1");
					out.println("2");
					break;
				case 3:
					out.println("1");
					out.println("0");
					out.println("100000");
					break;
				case 4:
					out.println("2");
					out.println("0 50000");
					out.println("50001 100000");
					break;
				case 5:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((2 * i));
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((2 * i + 1));
					}
					out.println();
					break;
				case 6:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((100 * i));
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((100 * (i + 1) - 1));
					}
					out.println();
				case 7:
				case 8:
				case 9:
				case 10:
				case 11:
					out.println("1000");
					int[] a = new int[2000];
					int k = 0;
					for (int i = 0; i < a.length; i++) {
						while (true) {
							if (100001 - k <= a.length - i
									|| rand.nextInt(100001) < a.length) {
								a[i] = k;
								k++;
								break;
							}
							k++;
						}
					}
					for (int i = 1; i < a.length; i++) {
						if (a[i] == a[i - 1]) {
							i += 0;
						}
					}
					StringBuffer sb = new StringBuffer();
					int h = 0;
					for (int i = 0; i < a.length; i++) {
						if (h == 0 || (a.length - i > h && rand.nextBoolean())) {
							sb.append("(");
							h++;
						} else {
							sb.append(")");
							h--;
						}
					}
					ArrayList<Integer> al = new ArrayList<Integer>();
					for (int i = 0; i < a.length; i++) {
						if (sb.charAt(i) == '(') {
							al.add(a[i]);
						}
					}
					Collections.shuffle(al);
					for (int i = 0; i < al.size(); i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print(al.get(i));
					}
					out.println();
					al = new ArrayList<Integer>();
					for (int i = 0; i < a.length; i++) {
						if (sb.charAt(i) == ')') {
							al.add(a[i]);
						}
					}
					Collections.shuffle(al);
					for (int i = 0; i < al.size(); i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print(al.get(i));
					}
					out.println();
					break;
				case 12:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((i % 2 == 0 ? i : 100000 - i));
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((i % 2 == 1 ? i : 100000 - i));
					}
					out.println();
					break;
				case 13:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print(i);
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((100000 - i));
					}
					out.println();
					break;
				case 14:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((2 * i + 3000));
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((2 * i + 6001));
					}
					out.println();
					break;
				case 15:
					out.println("1000");
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((5 * i + 100));
					}
					out.println();
					for (int i = 0; i < 1000; i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print((5 * i + 103));
					}
					out.println();
					break;
				default:
					int n = 1 + rand.nextInt(1000);
					a = new int[2 * n];
					k = 0;
					for (int i = 0; i < a.length; i++) {
						while (true) {
							if (100001 - k <= a.length - i
									|| rand.nextInt(100001) < a.length) {
								a[i] = k;
								k++;
								break;
							}
							k++;
						}
					}
					sb = new StringBuffer();
					h = 0;
					for (int i = 0; i < a.length; i++) {
						if (h == 0 || (a.length - i > h && rand.nextBoolean())) {
							sb.append("(");
							h++;
						} else {
							sb.append(")");
							h--;
						}
					}
					out.println(n);
					al = new ArrayList<Integer>();
					for (int i = 0; i < a.length; i++) {
						if (sb.charAt(i) == '(') {
							al.add(a[i]);
						}
					}
					Collections.shuffle(al);
					for (int i = 0; i < al.size(); i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print(al.get(i));
					}
					out.println();
					al = new ArrayList<Integer>();
					for (int i = 0; i < a.length; i++) {
						if (sb.charAt(i) == ')') {
							al.add(a[i]);
						}
					}
					Collections.shuffle(al);
					for (int i = 0; i < al.size(); i++) {
						if (i != 0) {
							out.print(" ");
						}
						out.print(al.get(i));
					}
					out.println();
					break;
				}
				out.close();
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
	}

}
