import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class gen_decorator {
	static Random rand = new Random(132123);

	public static void main(String[] args) throws IOException {
		for (int test = 1; test <= 50; test++) {
			System.out.println("Generating test " + test);
			PrintWriter out = new PrintWriter((test < 10 ? "0" : "") + test);
			switch (test) {
			case 1:
				out.println("7");
				out.println("1 2 1 3 1 2 1");
				out.println("3");
				out.println("0 4 5 2");
				out.println("1 3 1 2");
				out.println("1 3 1 3");
				break;
			case 2:
				out.println("2");
				out.println("1 2");
				out.println("5");
				out.println("1 1 2 1");
				out.println("0 2 2 1");
				out.println("1 1 2 1");
				out.println("0 1 2 3");
				out.println("1 1 1 2");
				break;
			case 11:
				out.println("1");
				out.println("1");
				out.println("100000");
				for (int i = 0; i < 100000; i++) {
					if (i % 2 == 0) {
						out.println("0 1 1 " + (i + 1));
					} else {
						out.println("1 1 1 1");
					}
				}
				break;
			case 3:
				out.println("2");
				out.println("1 1");
				out.println("19");
				out.println("1 1 1 1");
				out.println("1 1 1 2");
				out.println("1 1 2 1");
				out.println("1 2 2 1");
				out.println("0 1 2 2");
				out.println("1 1 1 1");
				out.println("1 2 2 1");
				out.println("1 1 1 2");
				out.println("1 1 2 1");
				out.println("0 1 1 3");
				out.println("1 1 1 1");
				out.println("1 1 1 2");
				out.println("1 2 2 1");
				out.println("1 1 2 1");
				out.println("0 1 2 4");
				out.println("1 1 1 1");
				out.println("1 1 1 2");
				out.println("1 2 2 1");
				out.println("1 1 2 1");
				break;
			case 4: {
				int n = 15;
				out.println(n);
				int cnt = 1;
				for (int i = 0; i < n; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(cnt);
				}
				out.println();
				cnt++;
				int m = 0;
				for (int l = 0; l < n; l++) {
					for (int r = l; r < n; r++) {
						for (int i = 0; i < n; i++) {
							for (int j = 0; j <= i; j++) {
								for (int k = 1; i + k <= n; k++) {
									m++;
								}
							}
						}
						m++;
					}
				}
				out.println(m);
				for (int l = 0; l < n; l++) {
					for (int r = l; r < n; r++) {
						for (int i = 0; i < n; i++) {
							for (int j = 0; j <= i; j++) {
								for (int k = 1; i + k <= n; k++) {
									out.println("1 " + (i + 1) + " " + (j + 1)
											+ " " + k);
								}
							}
						}
						out.println("0 " + (l + 1) + " " + (r + 1) + " "
								+ cnt++);
					}
				}

			}
				break;
			case 5: {
				int n = 6;
				ArrayList<int[]> al = new ArrayList<int[]>();
				genAll(0, new int[n], 0, al);
				Collections.shuffle(al, rand);
				out.println(n);
				boolean first = true;
				int cnt = 0;
				for (int[] a : al) {
					if (first) {
						first = false;
						for (int i = 0; i < a.length; i++) {
							if (i > 0) {
								out.print(" ");
							}
							out.print(a[i]);
						}
						out.println();
						out.println("19426");
					} else {
						int prev = 0;
						for (int i = 0; i < a.length; i++) {
							if (i + 1 == a.length || a[i] != a[i + 1]) {
								out.println("0 " + (prev + 1) + " " + (i + 1)
										+ " " + a[i]);
								cnt++;
								prev = i + 1;
							}
						}
					}
					for (int i = 0; i < n; i++) {
						for (int j = 0; j < n; j++) {
							for (int k = 1; Math.max(i, j) + k - 1 < n; k++) {
								out.println("1 " + (i + 1) + " " + (j + 1)
										+ " " + k);
								cnt++;
							}
						}
					}
				}
			}
				break;
			case 6:
			case 7:
			case 8:
			case 9:
			case 10: {
				out.println("100000");
				for (int i = 0; i < 99999; i++) {
					out.print("255 ");
				}
				out.println("1024");
				out.println("100000");
				int cnt = 0;
				while (cnt < 100000) {
					if (cnt + 2 <= 100000 && rand.nextInt(5) == 0) {
						int l = 50000 + rand.nextInt(50001);
						int x = 1 + rand.nextInt(100000);
						int y = 1 + rand.nextInt(100000);
						out.println("0 1 " + l + " " + x);
						out.println("0 " + l + " 100000 " + y);
						cnt += 2;
					} else {
						int l = 1 + rand.nextInt(1000);
						int r = 1 + rand.nextInt(1000);
						int k = 1 + rand.nextInt(100000 - Math.max(l, r) + 1);
						out.println("1 " + l + " " + r + " " + k);
					}
				}
			}
				break;
			default: {
				int n = test < 40 ? 1 + rand.nextInt(100000) : 100000;
				int m = test < 40 ? 1 + rand.nextInt(100000) : 100000;
				out.println(n);
				for (int i = 0; i < n; i++) {
					if (i > 0) {
						out.print(" ");
					}
					out.print(1 + rand.nextInt(100000));
				}
				out.println();
				out.println(m);
				int MAX = 60000;
				for (int i = 0; i < m; i++) {
					int l = 1 + rand.nextInt(n);
					int r = 1 + rand.nextInt(n);
					if (rand.nextInt(500) != 0) {
						if (test > 35 && n > MAX) {
							l = 1 + rand.nextInt(n - MAX);
							r = l + MAX + rand.nextInt(n - MAX - l + 1);
						}
						int k = 35 <= test && test <= 45 ? 1 + rand.nextInt(5)
								: 1 + rand.nextInt(100000);
						out.println("0 " + Math.min(l, r) + " "
								+ Math.max(l, r) + " " + k);
					} else {
						int k = 1 + rand.nextInt(n - Math.max(l, r) + 1);
						if (test > 35) {
							l = 1 + rand.nextInt(Math.min(n, 1000));
							r = 1 + rand.nextInt(Math.min(n, 1000));
							k = n - Math.max(l, r) + 1 - rand.nextInt(100);
							k = Math.max(k, 1);
						}
						out.println("1 " + l + " " + r + " " + k);
					}
				}
			}
				break;
			}
			out.close();
		}
	}

	private static void genAll(int n, int[] s, int max, ArrayList<int[]> al) {
		if (n == s.length) {
			s = s.clone();
			for (int i = 0; i < s.length; i++) {
				s[i]++;
			}
			al.add(s);
			return;
		}
		for (int i = 0; i <= max; i++) {
			s[n] = i;
			genAll(n + 1, s, Math.max(max, i + 1), al);
		}
	}
}
