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

public class TestsGen {
	static int testcount = 0;

	static Random random = new Random(6438732);
	
	static int MAX = (int) 1e6;

	static void write(int n, int k) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		out.println(n + " " + k);
		out.close();
	}

	static void writeRand() throws IOException {
		write(random.nextInt(MAX) + 1, random.nextInt(MAX) + 1);
	}
	
	static void writeMax(int MAX) throws IOException {
		boolean[] np = new boolean[MAX + 1];
		np[0] = true;
		np[1] = true;
		for (int i = 2; i <= MAX; i++) {
			if (!np[i]) {
				int j = 2 * i;
				while (j < np.length) {
					np[j] = true;
					j += i;
				}
			}
		}
		int max = 0;
		int kmax = 0;
		for (int k = 1; k < MAX; k++) {
			int t = 0;
			for (int i = k + 2; i <= MAX; i++) {
				if (!np[i] && !np[i - k]) {
					t++;
				}
			}
			if (t > max) {
				max = t;
				kmax = k;
			}
		}
		write(MAX, kmax);
	}

	public static void main(String[] args) throws IOException {
		while (new File(String.format("%02d.t", testcount + 1)).exists()) {
			testcount++;
		}
		write(MAX, 2);
		write(MAX, 4);
		write(MAX, 6);
		for (int i = 0; i < 10; i++) {
			writeRand();
		}
		for (int i = 0; i < 5; i++) {
			write(random.nextInt(MAX) + 1, 2);
		}
		write(MAX, 9973 - 2);
		write(9973, 9973 - 17);
		writeMax(1000);
		writeMax(10000);
		write(100000, 2310);
		write(MAX, 2310);
//		writeMax(100000);
	}

}
