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

public class gen_firtree implements Runnable {
	public static void main(String[] args) {
		if (args.length < 1) {
			for (I = 1; (new File(getName(I) + ".t")).exists(); I++)
				;
		} else {
			if (args[0].equals("stress")) {
				STRESS_MODE = true;
				if (args.length >= 2) {
					FNAME = args[1];
				} else {
					FNAME = "01";
				}
			} else {
				I = Integer.parseInt(args[0]);
			}
		}
		new Thread(new gen_firtree()).start();
	}

	PrintWriter out;

	Random rand = new Random(6439586L);
	
	static int I;

	static boolean STRESS_MODE;
	static String FNAME;
	
	
	static String getName(int i) {
		return ((i < 10) ? "0" : "") + i;
	}

	void open() {
		try {
			if (STRESS_MODE) {
				out = new PrintWriter(FNAME);
			} else {
				System.out.println("Generating test " + I);
				out = new PrintWriter(getName(I));
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}

	void close() {
		out.close();
		I++;
	}

	final String ALPHA = "abcdefghijklmnopqrstuvwxyz";

	String randString(int len, String alpha) {
		StringBuilder ans = new StringBuilder();
		int k = alpha.length();
		for (int i = 0; i < len; i++) {
			ans.append(alpha.charAt(rand.nextInt(k)));
		}
		return ans.toString();
	}

	long rand(long l, long r) {
		return l + (rand.nextLong() >>> 1) % (r - l + 1);
	}

	int rand(int l, int r) {
		return l + rand.nextInt(r - l + 1);
	}
	
	final int MAX = 1000000000;
	
	void genTest(int n, int m, int LL, int RL, int LH, int RH) {
		open();
		out.println(n);
		for (int i = 0; i < n; ++i) {
			if (i > 0) {
				out.print(" ");
			}
			out.print(rand(LL, RL));
		}
		out.println();
		for (int i = 0; i < n - 1; ++i) {
			if (i > 0) {
				out.print(" ");
			}
			out.print(rand(LH, RH));
		}
		out.println();
		out.println(m);
		for (int i = 0; i < m; ++i) {
			int a = rand(1, n - 1);
			int b = rand(1, n - 1);
			if (a > b) {
				int tmp = a;
				a = b;
				b = tmp;
			}
			++b;
			if (rand.nextBoolean()) {
				out.println(a + " " + b);
			} else {
				out.println(b + " " + a);
			}
		}
		close();
	}
	
	public void solve() throws IOException {
		genTest(2, 1, 1, 1, 1, 1);
		for (int i = 0; i < 5; ++i) {
			genTest(rand(2, 10), rand(2, 10), 1, 10, -10, 10);
		}
		for (int i = 0; i < 3; ++i) {
			genTest(rand(800, 1000), rand(800, 1000), 1, MAX, -MAX, MAX);
		}
		genTest(rand(800, 1000), rand(800, 1000), MAX, MAX, -MAX, MAX);
		genTest(1000, 1000, MAX, MAX, -MAX, -MAX);
		genTest(rand(800, 1000), rand(800, 1000), 1, MAX, MAX, MAX);
		
		for (int i = 0; i < 5; ++i) {
			genTest(rand(80000, 100000), rand(80000, 100000), 1, MAX, -MAX, MAX);
		}
		genTest(rand(80000, 100000), rand(80000, 100000), MAX, MAX, -MAX, MAX);
		genTest(100000, 100000, MAX, MAX, MAX, MAX);
		genTest(rand(80000, 100000), rand(80000, 100000), 1, MAX, -MAX, -MAX + 100);
	}
	
	void myAssert(boolean e) {
		if (!e) {
			throw new Error("Assertion failed");
		}
	}

	public void run() {
		try {
			solve();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(-1);
		}
	}
}