import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;


public class TestsGen {
	final static int MAXK = 1000000000; 
	final static int MAXANS = 800;
	static Random rnd = new Random(3);
	
	static boolean inBounds(int x) {
		return -MAXK <= x && x <= MAXK;
	}
	
	static class Point {
		int x, y;

		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}
		
		public Point(int x) {
			this.x = x;
		}
		
		@Override
		public String toString() {
			return x + " " + y;
		}
	}
	
	static class Segment {
		Point a, b;

		public Segment(Point a, Point b) {
			this.a = a;
			this.b = b;
		}
		
		public Segment(int x1, int x2) {
			a = new Point(x1);
			b = new Point(x2);
		}
		
		public Segment(int x1, int y1, int x2, int y2) {
			a = new Point(x1, y1);
			b = new Point(x2, y2);
		}
		
		@Override
		public String toString() {
			return a + " " + b;
		}
	}

	static int tests = 0;
	static void out(Segment s1, Segment s2) throws FileNotFoundException {
		tests++;
		System.err.print("[" + tests + "]");
		PrintWriter out = new PrintWriter(String.format("%02d", tests));
		out.println(s1);
		out.println(s2);
		out.close();
	}
	
	static Point split(long len) {
		ArrayList<Long> a = new ArrayList<Long>();
		for (long i = 1; i < len; i++) {
			long b = (long) Math.sqrt(len * len - i * i);
			if (i * i + b * b == len * len) {
				a.add(i);
				a.add(b);
			}
		}
		int size = a.size();
		if (size == 0)
			return null;
		long x = a.get(rnd.nextInt(size));
		long y = (long) Math.sqrt(len * len - x * x);
		if (x * x + y * y != len * len)
			throw new AssertionError();
		if (rnd.nextBoolean()) 
			x = -x;
		if (rnd.nextBoolean())
			y = -y;
		return new Point((int)x, (int)y);
	}
	
	public static void main(String[] args) throws FileNotFoundException {
		out(new Segment(0, 1), new Segment(1, 2));
		out(new Segment(0, 1), new Segment(0, 1));
		out(new Segment(MAXK, MAXK - 1000), new Segment(MAXK - MAXANS * 1000, MAXK - (MAXANS - 1) * 1000));
		for (int i = 0; i < 12; i++) {
			int len = rnd.nextInt((int) Math.pow(10, rnd.nextInt(Integer.toString(MAXK).length() - 2))) + 1;
			int allowedSteps = (2 * MAXK - len) / len - 1;
			int a = rnd.nextInt(allowedSteps);
			int b = rnd.nextInt(allowedSteps);
			if (b > a + MAXANS - 1) {
				b = a + MAXANS - 1;
			}
			if (b < a - MAXANS + 1) {
				b = a + MAXANS - 1;
			}
			int delta = rnd.nextInt(len);
			Segment s1, s2;
			if (rnd.nextBoolean()) {
				s1 = new Segment(-MAXK + delta + a * len, -MAXK + delta + a * len + len);
			} else {
				s1 = new Segment(-MAXK + delta + a * len + len, -MAXK + delta + a * len);
			}
			if (rnd.nextBoolean()) {
				s2 = new Segment(-MAXK + delta + b * len, -MAXK + delta + b * len + len);
			} else {
				s2 = new Segment(-MAXK + delta + b * len + len, -MAXK + delta + b * len);
			}
			out(s1, s2);
		}
		
		out(new Segment(0, 2), new Segment(1, 3));
		out(new Segment(0, 2), new Segment(3, 5));
		out(new Segment(MAXK, MAXK - 2), new Segment(MAXK - MAXANS * 2 + 3, MAXK - MAXANS * 2 + 5));
		
		for (int i = 0; i < 12; i++) {
			int len = rnd.nextInt((int) Math.pow(10, rnd.nextInt(Integer.toString(MAXK).length() - 2))) + 1;
			int allowedSteps = (2 * MAXK - len) / len - 1;
			int a = rnd.nextInt(allowedSteps);
			int b = rnd.nextInt(allowedSteps);
			if (b > a + MAXANS - 1) {
				b = a + MAXANS - 1;
			}
			if (b < a - MAXANS + 1) {
				b = a + MAXANS - 1;
			}
			int delta1 = rnd.nextInt(len);
			int delta2 = rnd.nextInt(len);
			Segment s1, s2;
			if (rnd.nextBoolean()) {
				s1 = new Segment(-MAXK + delta1 + a * len, -MAXK + delta1 + a * len + len);
			} else {
				s1 = new Segment(-MAXK + delta1 + a * len + len, -MAXK + delta1 + a * len);
			}
			if (rnd.nextBoolean()) {
				s2 = new Segment(-MAXK + delta2 + b * len, -MAXK + delta2 + b * len + len);
			} else {
				s2 = new Segment(-MAXK + delta2 + b * len + len, -MAXK + delta2 + b * len);
			}
			out(s1, s2);			
		}
		
		out(new Segment(-1, 0, 1, 0), new Segment(0, 1, 0, -1));
		out(new Segment(-MAXK, 0, 1, 0), new Segment(0, -MAXK, 0, 1));
		out(new Segment(0, 0, 5, 0), new Segment(3, 4, 6, 8));
		
		for (int i = 0; i < 17; i++) {
			int len = rnd.nextInt((int) Math.pow(10, rnd.nextInt(Integer.toString(MAXK).length() - 3))) + 1;
			Point sp = split(len);
			while (sp == null) {
				len = len = rnd.nextInt((int) Math.pow(10, rnd.nextInt(Integer.toString(MAXK).length() - 3))) + 1;
				sp = split(len);
			}
			Point delta1 = split(len);
			Point delta2 = split(len);
			int maxk = MAXK / 7 * 3;
			int x = -maxk + rnd.nextInt(2 * maxk);
			int y = -maxk + rnd.nextInt(2 * maxk);
			int maxans = MAXANS / 2;
			int delta = (int) Math.min(maxk, (long)(maxans) * 2L * len);
			int x2 = x - maxans + rnd.nextInt(delta);
			int y2 = y - maxans + rnd.nextInt(delta);
			if (!inBounds(x) || !inBounds(x2) || !inBounds(y) || !inBounds(y2)) {
				i--;
				continue;
			}
			Segment s1 = new Segment(x, y, x + delta1.x, y + delta1.y);
			Segment s2 = new Segment(x2, y2, x2 + delta2.x, y2 + delta2.y);
			out(s1, s2);
		}
	
	}
}
