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

public class TestGen implements Runnable {
	public static void main(String[] args) {
		new Thread(new TestGen()).start();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;
	Random rnd;
	boolean f;
	int TNumber, eps;

	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());
	}

	class road {
		int x, w, t;
	}
	
	public boolean nextBoolean() {
		if (rnd.nextInt(100) > eps)
			return !f;
		else 
			return f;
	}
	
	public void gen(int x0, int y0, int x1, int y1, int maxT) {
		int w = rnd.nextInt((x1 - x0) / 6) + 1;
		int h = rnd.nextInt((y1 - y0) / 6) + 1;
		int dw = rnd.nextInt((x1 - x0) / 6);
		int dh = rnd.nextInt((y1 - y0) / 6);
		int nw = w + x0;
		int nh = h + x0;
		int t = 0;
		while ((nw + dw < x1) && (nh + dh < y1) && (t < maxT)) {
			t++;
			nw += dw;
			nh += dh;
		}
		if (t < maxT)
			t += rnd.nextInt(maxT - t);
		
		if (TNumber % 10 == 9) {
			t = maxT;
		}
		f = false;
		int n = 0;
		int m = 0;
		road[] ans = new road[10000];
		road[] ansy = new road[10000];
		f = true;
		int l = 0;
		for (int i = x0 + 1; i < x1; i++) {
			boolean fl = nextBoolean();
			if (fl == f)
				continue;
			if (fl) {
				l = i;
				f = true;
				continue;
			}
			ans[n] = new road();
			ans[n].x = l;
			ans[n].w = i - l;
			ans[n].t = 1;
			f = false;
			n++;
			if (n == 10000)
				break;
		}
		if (f) {
			ans[n] = new road();
			ans[n].x = l;
			ans[n].w = x1 - l;
			ans[n].t = 1;
			n++;
		}
		f = false;
		l = -1;
		for (int i = y0; i < y1; i++) {
			boolean fl = nextBoolean();
			if (fl == f)
				continue;
			if (fl) {
				l = i;
				f = true;
				continue;
			}
			ansy[m] = new road();
			ansy[m].x = l;
			ansy[m].w = i - l;
			ansy[m].t = 0;
			f = false;
			m++;
			if (m == 10000)
				break;
		}
		if (f) {
			ansy[m] = new road();
			ansy[m].x = l;
			ansy[m].w = y1 - l;
			ansy[m].t = 0;
			m++;
		}
		if ((TNumber % 10 == 3) || (TNumber % 10 == 4)) {
			dw = 0;
			dh = 0;
			m = 0;
		}
		if ((TNumber % 10 == 5) || (TNumber % 10 == 6))
			m = 0;
		out.print(n);
		out.print(' ');
		out.print(m);
		out.print(' ');
		out.print(t);
		out.print(' ');
		out.println(rnd.nextInt(100) + 1);
		
		out.print(h);
		out.print(' ');
		out.print(w);
		out.print(' ');
		out.print(dw);
		out.print(' ');
		out.println(dh);
		
		for (int i = 0; i < n; i++) {
			out.print(ans[i].x);
			out.print(' ');
			out.println(ans[i].w);
		}
		
		for (int i = 0; i < m; i++) {
			out.print(ansy[i].x);
			out.print(' ');
			out.println(ansy[i].w);
		}
		
	}

	public void solve() throws IOException {
		rnd = new Random(1234567);
		
		for (TNumber = 1; TNumber <= 50; TNumber++) {
			out.close();
			if (TNumber < 10) {
				out = new PrintWriter(new String("0").concat(Integer.toString(TNumber)));
			} else {
				out = new PrintWriter(Integer.toString(TNumber));
			}
			
			eps = 50;
			if (TNumber % 5 == 1)
				eps = 70;
			if (TNumber % 10 == 2)
				eps = 80;
			if (TNumber % 10 == 3)
				eps = 95;
			if (TNumber % 10 == 4)
				eps = 98;
			if (TNumber <= 5) {
				gen(0, 0, rnd.nextInt(5) + 16, rnd.nextInt(5) + 16, 10);
				continue;
			}
			if (TNumber <= 10) {
				gen(0, 0, rnd.nextInt(20) + 80, rnd.nextInt(20) + 80, 100);
				continue;
			}
			if (TNumber <= 25) {
				gen(0, 0, rnd.nextInt(100) + 900, rnd.nextInt(100) + 900, 100);
				continue;
			}
			if (TNumber <= 30) {
				gen(0, 0, 1000, 1000, 100);
				continue;
			}
			if (TNumber <= 35) {
				gen(0, 0, rnd.nextInt(1000) + 9000, rnd.nextInt(1000) + 9000, 1000);
				continue;
			}
			if (TNumber <= 40) {
				gen(0, 0, 10000, 10000, 9000);
				continue;
			}
			if (TNumber <= 45) {
				gen(0, 0, rnd.nextInt(10000) + 90000, rnd.nextInt(10000) + 90000, 90000);
				continue;
			}
			if (TNumber <= 50) {
				gen(0, 0, 100000, 100000, 1000000);
				continue;
			}
			
		}
		out.close();
	}

	public void run() {
		try {
			out = new PrintWriter("ecs.in");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}