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

public class Gen {

	static int done = 0;

	static final Random rand = new Random(556668949239L);

	static ArrayList<String> data = new ArrayList<>();

	static void print(long l, long r) throws IOException {
		done++;
		if (r < l) {
			long t = l;
			l = r;
			r = t;
		}
		PrintWriter out;
		if (done < 10)
			out = new PrintWriter("../tests/0" + String.valueOf(done));
		else
			out = new PrintWriter("../tests/" + String.valueOf(done));
		out.println(l + " " + r);
		System.err.println("------New Test---");
		System.err.println("l = " + l + " " + "r = " + r);
		System.err.println(Long.toBinaryString(l) + " "
				+ Long.toBinaryString(r));
		System.err.println("r - l = " + (r - l));
		out.close();
	}
	
	static void genSimple() throws IOException {
		PrintWriter out;
		out = new PrintWriter("../preliminary/01");
		out.println("3 7");
		out.close();
	}

	static void genGroup(long r, int bits) throws IOException {
		print(1, r);
		print(r / 2, r / 2);
		print(rand.nextInt(10) + 2, r);
		print((1 << (bits - 1)) - 1, (1 << bits) - 1);
		long first = 2;
		while (first < r) {
			first = first * 4 + 2;
		}
		first /= 4;
		long second = 1;
		while (second < r) {
			second = second * 4 + 1;
		}
		second /= 4;
		print(first, second);
		print((1 << bits) - 1, second);
		print((1 << (bits - 1)) - 1, first);

		for (int i = 0; i < 5; i++) {
			print(rand.nextInt((int) r / 3),
					(int) r / 2 + rand.nextInt((int) r / 2));
		}

	}

	public static void main(String[] args) throws IOException {
		boolean f = (new File("../preliminary")).mkdir();
		f = new File("../tests").mkdir();

		genSimple();
		genGroup(300, 8);
		genGroup(3000, 12);
		genGroup(5 * 1000 * 1000 * 100, 28);

	}
}
