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

class TestsGen {
	public static void main(String[] args) {
		new TestsGen().run();
	}

	int testNum = 0;
	static Random rand = new Random(1);

	class Point {
		double x, y;

		public Point(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		public Point(double x, double y) {
			super();
			this.x = x;
			this.y = y;
		}

		@Override
		public String toString() {
			return Math.round(x) + " " + Math.round(y);
		}

	}

	class Circle {
		Point center;
		double radius;

		public Circle(Point center, double radius) {
			super();
			this.center = center;
			this.radius = radius;
		}

		@Override
		public String toString() {
			return center + " " + Math.round(radius);
		}
	}

	class Test {
		Circle[] p;
		Point lineFirst, lineSecond;

		public Test(Circle[] p, Point lineFirst, Point lineSecond) {
			super();
			this.p = p;
			this.lineFirst = lineFirst;
			this.lineSecond = lineSecond;
		}

	}

	void printTest(Test test) {
		try {
			++testNum;
			PrintWriter out = new PrintWriter("" + (testNum / 10)
					+ (testNum % 10));
			out.println(test.lineFirst + " " + test.lineSecond);
			out.println(test.p.length);
			for (Circle c : test.p) {
				out.println(c);
			}
			System.err.println("Generated test #" + testNum);
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	final int MAX = (int) 1e5;

	void run() {
		printTest(new Test(new Circle[] { new Circle(new Point(5, 5), 1) },
				new Point(0, 0), new Point(1, 1)));
		printTest(new Test(new Circle[] { new Circle(new Point(5, 5), 5),
				new Circle(new Point(-5, 5), 8),
				new Circle(new Point(-3, -5), 3) }, new Point(1, 1), new Point(
				2, 3)));
		printTest(new Test(new Circle[] { new Circle(new Point(MAX, MAX), MAX),
				new Circle(new Point(-MAX, -MAX), MAX),
				new Circle(new Point(MAX, -MAX), MAX),
				new Circle(new Point(-MAX, MAX), MAX) }, new Point(MAX, MAX),
				new Point(-MAX, -MAX)));
		printTest(genNoIntersectTest(100000, MAX / 10));
		printTest(genEqualCirclesTest(100000, MAX / 10));
		final int[] N = { 2, 10, 100, 500, 1200, 5700, 10000, 20000, 50000,
				100000 };
		for (int i = 0; i < 10; i++) {
			printTest(genRandomTest(N[i], Math.min(MAX / 4, N[i] * 50)));
			printTest(genHorizontal(N[i], Math.min(MAX / 4, N[i] * 50)));
			printTest(genVertical(N[i], Math.min(MAX / 4, N[i] * 50)));
			printTest(genNestedTest(N[i], Math.min(MAX / 4, N[i] * 50)));
			printTest(genTest(N[i], Math.min(MAX / 10, N[i] * 50)));
		}
		for (int i = 0; i < 5; i++) {
			printTest(genOverflowTest(100000, MAX));
		}
	}

	Test genRandomTest(int n, int max) {
		Circle[] p = new Circle[n];
		for (int i = 0; i < n; i++) {
			p[i] = genRandomCircle(max);
		}
		return new Test(p, genRandomPoint(max), genRandomPoint(max));
	}

	Test genTest(int n, int max) {
		Circle[] p = new Circle[n];
		Point a = genRandomPoint(max);
		Point b = genRandomPoint(max);
		for (int i = 0; i < n; i++) {
			if (rand.nextBoolean()) {
				p[i] = genIntersecting(a, b, max);
			} else {
				p[i] = genNotIntersecting(a, b, max);
			}
		}
		return new Test(p, a, b);
	}

	Test genNoIntersectTest(int n, int max) {
		Circle[] p = new Circle[n];
		Point a = genRandomPoint(max);
		Point b = genRandomPoint(max);
		for (int i = 0; i < n; i++) {
			p[i] = genNotIntersecting(a, b, max);
		}
		return new Test(p, a, b);
	}

	Test genOverflowTest(int n, int max) {
		Circle[] p = new Circle[n];
		int max2 = max / 20;
		max -= max2;
		Point a = new Point((rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1), 
							(rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1));
		Point b = new Point((rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1),
							(rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1));
		for (int i = 0; i < n; i++) {
			p[i] = new Circle(new Point((rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1), 
										(rand.nextBoolean() ? 1 : -1) * (rand.nextInt(max2) + max + 1)), 
										(rand.nextInt(max2) + max + 1));
		}
		return new Test(p, a, b);
	}

	Test genEqualCirclesTest(int n, int max) {
		Point a = genRandomPoint(max);
		Point b = genRandomPoint(max);
		Circle e = genIntersecting(a, b, max);
		Circle[] p = new Circle[n];
		for (int i = 0; i < n; i++) {
			p[i] = new Circle(new Point(e.center.x, e.center.y), e.radius);
		}
		return new Test(p, a, b);
	}

	Test genVertical(int n, int max) {
		Point a = genRandomPoint(max);
		Point b = new Point(a.x, rand.nextInt(2 * max + 1) - max);
		Circle[] p = new Circle[n];
		for (int i = 0; i < n; i++) {
			int y = rand.nextInt(2 * max + 1) - max;
			int r = rand.nextInt(max) + 1;
			double x;
			if (rand.nextInt(3) == 0) {
				x = (rand.nextBoolean() ? 1 : -1) * r + a.x;
			} else if (rand.nextBoolean()) {
				x = (rand.nextBoolean() ? 1 : -1) * rand.nextInt(r) + a.x;
			} else {
				x = (rand.nextBoolean() ? 1 : -1)
						* (rand.nextInt(r) + r + 1) + a.x;
			}
			p[i] = new Circle(new Point(x, y), r);
		}
		return new Test(p, a, b);
	}

	Test genHorizontal(int n, int max) {
		Point a = genRandomPoint(max);
		Point b = new Point(rand.nextInt(2 * max + 1) - max, a.y);
		Circle[] p = new Circle[n];
		for (int i = 0; i < n; i++) {
			int x = rand.nextInt(2 * max + 1) - max;
			int r = rand.nextInt(max) + 1;
			double y;
			if (rand.nextInt(3) == 0) {
				y = (rand.nextBoolean() ? 1 : -1) * r + a.y;
			} else if (rand.nextBoolean()) {
				y = (rand.nextBoolean() ? 1 : -1) * rand.nextInt(r) + a.y;
			} else {
				y = (rand.nextBoolean() ? 1 : -1)
						* (rand.nextInt(r) + r + 1) + a.y;
			}
			p[i] = new Circle(new Point(x, y), r);
		}
		return new Test(p, a, b);
	}

	Test genNestedTest(int n, int max) {
		Circle[] p = new Circle[n];
		p[0] = genRandomCircle(1);
		for (int i = 1; i < n; i++) {
			p[i] = new Circle(new Point(p[i - 1].center.x, p[i - 1].center.y),
					Math.min(p[i - 1].radius + 1, max));
		}
		return new Test(p, genRandomPoint(max), genRandomPoint(max));
	}

	Circle genRandomCircle(int max) {
		return new Circle(genRandomPoint(max), rand.nextInt(max) + 1);
	}

	Circle genIntersecting(Point a, Point b, int max) {
		int x = rand.nextInt(2 * max + 1) - max;
		double dx = b.x - a.x;
		double dy = b.y - a.y;
		int r = rand.nextInt(max) + 1;
		int y = (int) (Math.floor(dy * (x / dx)) + (rand.nextBoolean() ? 1 : -1)
				* (r / 2));
		y %= max;
		return new Circle(new Point(x, y), r);
	}

	Circle genNotIntersecting(Point a, Point b, int max) {
		int x = rand.nextInt(max + 1) - max / 2;
		double dx = b.x - a.x;
		double dy = b.y - a.y;
		int r = rand.nextInt(max / 2) + 1;
		int y = (int) (Math.floor(dy * (x / dx)) + (rand.nextBoolean() ? 1 : -1)
				* (2 * r));
		y %= max;
		return new Circle(new Point(x, y), r);
	}

	Point genRandomPoint(int max) {
		return new Point(rand.nextInt(2 * max + 1) - max, rand
				.nextInt(2 * max + 1)
				- max);
	}

}