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

public class TestsGen {

    static int done = 0;

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

    static final int MIN_MODULE = 1_000_000_000;
    static final int MAX_MODULE = 2_000_000_000;

    static class Hashing {
	int base, mod;

	public Hashing(int base, int mod) {
	    super();
	    this.base = base;
	    this.mod = mod;
	}

	@Override
	public String toString() {
	    return base + " " + mod;
	}

    }

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

    static void print(Hashing hashing) throws IOException {
	done++;
	System.err.println(done);
	PrintWriter out;
	if (done < 10)
	    out = new PrintWriter("../tests/00" + String.valueOf(done));
	else if (done < 100)
	    out = new PrintWriter("../tests/0" + String.valueOf(done));
	else
	    out = new PrintWriter("../tests/" + String.valueOf(done));
	out.println(hashing);
	out.close();
    }

    public static void main(String[] args) throws IOException {
	boolean f = new File("../tests").mkdir();
	print(new Hashing(31, (int) (MIN_MODULE + 7)));
	data.add(new Hashing(31, (int) (MAX_MODULE - 1)));
	for (int i = 2; i < 31; i++) {
	    data.add(new Hashing(i, rand.nextInt(25) + MAX_MODULE - 25));
	    double t = Math.pow(i, rand.nextInt(24) + 6)
		    * (rand.nextInt(i) + 1);
	    while (t < MIN_MODULE || t > MAX_MODULE)
		t = Math.pow(i, rand.nextInt(24) + 6) * (rand.nextInt(i) + 1);
	    data.add(new Hashing(i, (int) t));
	}
	for (int i = 32; i < 101; i++) {
	    data.add(new Hashing(i, rand.nextInt(25) + MAX_MODULE - 25));
	    data.add(new Hashing(i, MIN_MODULE + rand.nextInt(MIN_MODULE)));
	}
	Collections.shuffle(data, rand);
	for (Hashing hash : data)
	    print(hash);

	return;
    }
}
