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

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

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	int tNumber = 0;
	
	void print(int n, int m, int s, int r) throws IOException {
		System.err.println(tNumber);
		if (tNumber < 10) {
			out = new PrintWriter("../tests/0" + tNumber);
		} else {
			out = new PrintWriter("../tests/" + tNumber);
		}
		tNumber++;
		out.println(n + " " + m + " " + s + " " + r);
		out.close();
	}
	public void generate() throws IOException {
		new File("../tests").mkdir();
		   Random rand = new Random(7477447);
			tNumber = 1;
		print(3, 2, 2, 1);
		print(3, 2, 3, 1);
		int maxn = 100000;
		int maxs = 1000000000;
		for (int i = 1; i <= 65; i++) {
			int n = rand.nextInt(100) + 1;
			int m = rand.nextInt(130) + 1;
			int r = rand.nextInt(100) + 1;
			int s = rand.nextInt(n * r - n + 1)-rand.nextInt(500);
			print(n, m, s, r);
		}
		print(100000, 100000, 1000000000 - 10000, 10000);
		print(100000, 100000 - 2, 1000000, 10000);
		print(50000, 100000, 49998, 2);
		print(50000, 100000, 49999, 74);
		print(77777, 100000, 77777*77, 100);
		print(100000, 100000, -1000000000, 10000);
		print(100, 4951, 1000, 100);
		print(100000, 77777, 1000000, 10000);
		print(10000, 100000, 9999*1000 - 777, 1000);
		print(10000, 100000, 9999*1000 - 7777, 1000);
		print(10000, 100000, 9999*1000 - 77777, 1000);
		print(10000, 100000, 9999*1000 - 777777, 1000);
		print(10000, 100000, 9999*1000 - 7777777, 1000);
		print(10000, 100000, 9999*1000 - 77777777, 1000);
		print(10000, 100000, 9999*10000 - 777777777, 10000);
		for (int i = 1; i <= 15; i++){
			int n = rand.nextInt(100000) + 1;
			int m = rand.nextInt(100000) + 1;
			int r = rand.nextInt(10000) + 1;
			int s = rand.nextInt(1000000000) - rand.nextInt(1000000000);
			print(n, m, s, r);
		}
	}
	public void run() throws IOException {
		Locale.setDefault(Locale.US);
		generate();
	}
}