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

public class test_generator {

	private static int testNum;
	private static PrintWriter writer;
	private static Random rnd;

	public static void main(String[] args) throws IOException {
		testNum = 0;
		Scanner scan = new Scanner(new FileReader("tests.t"));
		while (scan.hasNext()) {
			open();
			
			int k = scan.nextInt();
			int d = scan.nextInt();
			int w = scan.nextInt();
			int h = scan.nextInt();
			int n = scan.nextInt();
			writer.println(k + " " + d);
			writer.println(w + " " + h);
			writer.println(n);
			
			for (int i = 0; i < n; i++) {
				int x1 = scan.nextInt();
				int y1 = scan.nextInt();
				int x2 = scan.nextInt();
				int y2 = scan.nextInt();
				writer.println(x1 + " " + y1 + " " + x2 + " " + y2);
			}
			
			close();
		}
		
		rnd = new Random(287489471984741986l);
		
		genRandom(9, 10, 7, 4, 20, 5);
		genRandom(10, 10, 10, 3, 50, 10);
		genRandom(10, 8, 20, 10, 100, 3);
		genRandom(10, 10, 4, 1, 100, 10);		
		genRandom(10, 10, 100, 1, 100, 10);		
		genRandom(10, 10, 100, 10, 100, 10);
		genRandom(10, 10, 100, 500, 100, 10);
		genRandom(10, 10, 100, 150, 10, 4);
		genRandom(10, 10, 100, 500, 3, 2);
		
		genSpecial();
	}
	
	private static void genSpecial() throws IOException {
		open();
		int k = 100;
		int d = 500;
		int w = 10;
		int h = 10;
		int n = 100;
		writer.println(k + " " + d);
		writer.println(w + " " + h);
		writer.println(n);
		for (int i = 0; i < n / 2; i++) {
			writer.println("4 4 5 5");
			writer.println("4 5 5 4");
		}
		close();		
	}

	static final int[] dx = {1, 1, 1, 0, 0, -1, -1, -1};
	static final int[] dy = {1, 0, -1, 1, -1, 1, 0, -1};

	private static void genRandom(int wid, int hei, int k, int d, int n, int len) throws IOException {
		open();
		writer.println(k + " " + d);
		writer.println(wid + " " + hei);
		writer.println(n);
		for (int i = 0; i < n; i++) {
			boolean good = false;
			int x1 = 0, y1 = 0, dir = 0, l = 0;
			while (!good) {
				x1 = rnd.nextInt(wid);
				y1 = rnd.nextInt(hei);
				dir = rnd.nextInt(8);
				l = rnd.nextInt(len) + 1;
				if (dx[dir] > 0) {
					l = Math.min(l, wid - 1 - x1);
				} else if (dx[dir] < 0) {
					l = Math.min(l, x1);
				}
				if (dy[dir] > 0) {
					l = Math.min(l, hei - 1 - y1);
				} else if (dy[dir] < 0) {
					l = Math.min(l, y1);
				}
				good = (l > 0); 
			}
			int x2 = x1 + dx[dir] * l;
			int y2 = y1 + dy[dir] * l;
			writer.println(x1 + " " + y1 + " " + x2 + " " + y2);
		}
		close();		
	}

	private static void close() {
		writer.close();
	}

	private static void open() throws IOException {
		testNum++;
		String testStr = Integer.valueOf(testNum).toString();
		if (testNum < 10) testStr = "0" + testStr;
		writer = new PrintWriter(testStr);
	}

}
