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

public class TestsGen {
	static int testcount = 0;

	static Random random = new Random(635729);

	static int MAX = 1000;

	static void write(int[][] a) throws IOException {
		while (new File(String.format("%02d.t", testcount + 1)).exists()) {
			testcount++;
		}
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		out.println(a.length);
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < 3; j++) {
				out.print(a[i][j]);
				if (j < 3 - 1) {
					out.print(" ");
				}
			}
			out.println();
		}
		out.close();
	}

	static void writeOne() throws IOException {
		int[][] a = new int[1][3];
		for (int i = 0; i < 2; i++) {
			a[0][i] = random.nextInt(2 * MAX + 1) - MAX;
		}
		a[0][2] = random.nextInt(MAX) + 1;
		write(a);
	}

	static void writeTwo() throws IOException {
		int[][] a = new int[2][3];
		do {
			for (int i = 0; i < 2; i++) {
				for (int j = 0; j < 2; j++) {
					a[i][j] = random.nextInt(2 * MAX + 1) - MAX;
				}
				a[i][2] = random.nextInt(MAX) + 1;
			}
		} while (!good(a));
		write(a);
	}

	static void writeThree() throws IOException {
		int[][] a = new int[3][3];
		do {
			for (int i = 0; i < 3; i++) {
				for (int j = 0; j < 2; j++) {
					a[i][j] = random.nextInt(2 * MAX + 1) - MAX;
				}
				a[i][2] = random.nextInt(MAX) + 1;
			}
		} while (!good(a));
		write(a);
	}

	static boolean good(int[][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = i + 1; j < a.length; j++) {
				int len = (a[i][0] - a[j][0]) * (a[i][0] - a[j][0])
						+ (a[i][1] - a[j][1]) * (a[i][1] - a[j][1]);
				if (len <= (a[i][2] + a[j][2]) * (a[i][2] + a[j][2])) {
					return false;
				}
			}
		}
		if (a.length == 3) {
			int dx1 = a[1][0] - a[0][0];
			int dy1 = a[1][1] - a[0][1];
			int dx2 = a[2][0] - a[0][0];
			int dy2 = a[2][1] - a[0][1];
			if (dx1 * dy2 - dx2 * dy1 == 0) {
				return false;
			}
		}
		return true;
	}

	public static void main(String[] args) throws IOException {
		for (int i = 0; i < 15; i++) {
			writeOne();
			writeTwo();
			writeThree();
		}
	}

}
