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

public class Tests {
    private static File dir = new File("../tests");
    private int curTest = 1;
    private static boolean verbose = true;

    private String testName;
    private PrintWriter out;
    private Random r = new Random(9832L);
    
    static final int MAX = 1000;

    public void run() {
        t(10, 18, 20, 5, 8);
        t(2, 10, 5, 1, 3);
        t(20, 80, 100, 30, 50);
        t(10, 20, 20, 2, 8);
        t(1, 100, 120, 20, 119);
        t(1, MAX, MAX, 1, MAX - 1);
        t(1, MAX, MAX, MAX / 3, MAX / 2);
        t(239, 566, 1000, 500, 500);
        t(1, 1, 2, 1, 1);
        t(1, 1, MAX, MAX - 1, MAX - 1);
        t(1, MAX, MAX, MAX - 1, MAX - 1);
        t(566, 567, 570, 4, 4);
        t(566, 567, 570, 3, 4);
        t(1, MAX - 1, MAX, 1, MAX - 1);
        t(1, MAX, MAX, 1, MAX - 2);
        t(1, 4, 3, 1, 2);
        t(1, 4, 3, 2, 2);
        t(1, 3, 4, 1, 2);
        t(1, 3, 4, 2, 2);
        for (int t = 16; t >= 0;) {
        	int a = r.nextInt(1000) + 1;
        	int b = r.nextInt(1000) + 1;
        	int c = r.nextInt(1000) + 1;
        	int d = r.nextInt(1000) + 1;
        	int e = r.nextInt(1000) + 1;
            if (a <= b && d <= e && c - e >= a && c - d <= b) {
            	t(a, b, c, d, e);
            	t--;
            }
        }
    }

    private void t(int a, int b, int c, int d, int e) {
        open();
        out.println(String.format("%d %d %d %d %d", a, b, c, d, e));
        close();
    }

    private void open() {
        try {
            testName = "" + curTest / 10 + curTest % 10;
            out = new PrintWriter(new File(dir, testName));
            if (verbose) { 
                System.out.print("Generating " + testName + "...");
            }
        } catch (IOException e) {
            throw new RuntimeException("Unable to open " + testName + " for writing", e);
        }
    }

    private void close() {
        out.close();
        if (verbose) {
            System.out.println(" done.");
        }
        curTest++;
    }

    public static void main(String[] args) {
        Locale.setDefault(Locale.US);
        dir.mkdirs();
        new Tests().run();
    }
}
