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

public class TestsGen {
	static int testcount = 0;

	static Random random = new Random(9835234);

	static boolean[] good;

	static int MAX = 10000000;

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

	static void writeRand(int max) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		while (true) {
			int a = random.nextInt(max) + 1;
			int b = random.nextInt(max) + 1;
			if (a > b) {
				int t = a;
				a = b;
				b = t;
			}
			int cnt = 0;
			for (int i = a; i <= b; i++) {
				if (good[i]) {
					cnt++;
				}
			}
			if (cnt > 0) {
				out.println(random.nextInt(cnt) + 1);
				out.println(a + " " + b);
				break;
			}
		}
		out.close();
	}

	static void writeMax(int a, int b) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		int cnt = 0;
		for (int i = a; i <= b; i++) {
			if (good[i]) {
				cnt++;
			}
		}
		out.println(cnt);
		out.println(a + " " + b);
		out.close();
	}

	static void precalc() {
		good = new boolean[MAX + 1];
		Arrays.fill(good, true);
		for (int i = 2; i * i <= MAX; i++) {
			int j = i * i;
			while (j <= MAX) {
				good[j] = false;
				j += i * i;
			}
		}
	}

	public static void main(String[] args) throws IOException {
		precalc();
		while (new File(String.format("%02d.t", testcount + 1)).exists()) {
			testcount++;
		}
		writeMax(1, 1000);
		writeMax(566, 998);
		for (int i = 0; i < 5; i++) {
			writeRand(1000);
		}
		writeMax(1, MAX);
		writeMax(random.nextInt(MAX - 2) + 1, MAX - 2);
		write(1, MAX, 1);
		for (int i = 0; i < 12; i++) {
			writeRand(MAX);
		}
	}

}
