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

public class TestGen {

    static int done = 0;

    static final Random rand = new Random(556668949239L);
    static final int MAX_A = 10;
    static final int MAX_B = 10;
    static final int MAX_CHECK = 15;
    static final int MAX_TEST = 10000;

    static class Test {
	int a, b;
	int red, green, blue;

	public Test(int a, int b, int red, int green, int blue) {
	    super();
	    this.a = a;
	    this.b = b;
	    this.red = red;
	    this.green = green;
	    this.blue = blue;
	}

	@Override
	public String toString() {
	    return a + " " + b + "\n" + red + " " + green + " " + blue;
	}

    }

    static ArrayList<Test> all = new ArrayList<Test>();
    static ArrayList<Test> data = new ArrayList<Test>();

    static void print() throws IOException {
	done++;
	System.err.println(done + " " + data.size());
	PrintWriter out;
	if (done < 10)
	    out = new PrintWriter("../tests/0" + String.valueOf(done));
	else
	    out = new PrintWriter("../tests/" + String.valueOf(done));
	int k = data.size();
	out.println(k);
	for (int i = 0; i < k; i++)
	    out.println(data.get(i));
	data.clear();
	out.close();
    }

    static void genSimple() throws IOException {
	data.add(new Test(2, 10, 2, 4, 4));
	data.add(new Test(1, 2, 3, 4, 5));
	data.add(new Test(4, 2, 7, 7, 7));
	print();
    }

    static void genAll() throws IOException {
	for (int a = 1; a <= MAX_A; a++)
	    for (int b = 1; b <= MAX_B; b++)
		for (int red = 0; red <= MAX_CHECK; red++)
		    for (int blue = 0; blue <= MAX_CHECK; blue++)
			for (int green = 0; green <= MAX_CHECK; green++)
			    all.add(new Test(a, b, red, green, blue));
	Collections.shuffle(all, rand);
	int cur = 0;
	while (cur < all.size())
	{ 
	    data.add(all.get(cur));
	    cur++;
	    if (cur % MAX_TEST == 0) print();
	}
	if (data.size() != 0) print();
    }

    public static void main(String[] args) throws IOException {
	new File("../tests").mkdir();
	done = 0;
	genSimple();
	genAll();
	return;
    }
}