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

public class gentests implements Runnable {
  public static void main(String[] args) {
    if (args.length < 1) {
      I = 1;
    } else {
    	I = Integer.parseInt(args[0]);
    }
    new Thread(new gentests()).start();
  }
  
  PrintWriter out;
  Random rand = new Random(6082573165L);
  
  static int I;
  void open() {
    try {
      out = new PrintWriter(((I < 10) ? "0" : "") + I);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }
  void close() {
    out.close();
    I++;
  }
  
  int rand(int l, int r) {
    return l + rand.nextInt(r - l + 1);
  }
  
  int MIN_T = 0;
  int MAX_T = 1000000000;
  int MAX_C = 10000;
  int MAX_N = 100000;
  
  void genBorderTest(int n, int r)
  {
	open();
	out.println(n + " " + r);
	int t = rand(0, MAX_T - n);
	for (int i = 0; i < n; i++) {
		out.println(t + " " + MAX_C * rand(-1, 1) + " " + MAX_C * rand(-1, 1) + " " + MAX_C * rand(-1, 1) + " " + MAX_C * rand(-1, 1));
		t += rand(1, MAX_T - t - n + i + 1);
	}
	close();
  }
  
  void genTest(int n, int r, int b)
  {
	  open();
	  out.println(n + " " + r);
	  int t = rand(0, MAX_T - n);
	  for (int i = 0; i < n; i++) {
		  out.println(t + " " + rand(-b, b) + " " + rand(-b, b) + " " + rand(-b, b) + " " + rand(-b, b));
		  t += rand(1, MAX_T - t - n + i + 1);
	  }
	  close();
  }

  void genSimulTest(int n, int r, int b, int d)
  {
	  open();
	  out.println(n + " " + r);
	  int t = rand(0, MAX_T - n);
	  for (int i = 0; i < n; i++) {
		  int x = rand(-b + d, b - d);
		  int y = rand(-b + d, b - d);
		  out.println(t + " " + x + " " + y + " " + (x + rand(-d, d)) + " " + (y + rand(-d, d)));
		  t += rand(1, MAX_T - t - n + i + 1);
	  }
	  close();
  }
  
  public void solve() throws IOException {
	  genTest(2, 1, 5);
	  genSimulTest(2, 10, 5, 1);
	  
	  for (int i = 0; i < 5; i++) {
		  genTest(rand(2, 20), rand(0, 200), rand(10, 100));
	  }
	  for (int i = 0; i < 5; i++) {
		  genSimulTest(rand(2, 20), rand(0, 200), rand(10, 100), rand(0, 10));
	  }
	  
	  genBorderTest(MAX_N, MAX_C);
	  genTest(MAX_N, MAX_C, MAX_C);
	  genSimulTest(MAX_N, MAX_C, 10, 10);
	  
	  for (int i = 0; i < 5; i++) {
		  genTest(rand(10000, 100000), rand(0, MAX_C), rand(100, MAX_C));
	  }
	  for (int i = 0; i < 5; i++) {
		  genSimulTest(rand(10000, 100000), rand(0, MAX_C), rand(MAX_C / 2, MAX_C), rand(1, MAX_C / 2));
	  }
  }

  public void run() {
    try {
      solve();
    } catch (IOException e) {
      
    }
    
  }

}

