#include <stdio.h>
#include <stdlib.h>

#define N 50

#define MAXF (20000000-1)
#define MAXE (90-1)

#define MF   35

int main()
{
  int i, j, f, e, a, b, x, y;
  
  printf("%d\n", N);
  for (i=0; i<N; i++)
  {
    f=rand() % MAXF +1;
    e=rand() % MAXE +1;
    a=rand() % f;
    b=rand() % f;
    
    printf("%d %d %d %d\n", f, e, a, b);
    for (j=0; j<e; j++)
    {
      if ((rand() % 2)||(f<=MF))
        x=rand() % f +1; else
        x=rand() % MF +1;
      if ((rand() % 2)||(f<=MF-4))
        y=rand() % f +1; else
        y=rand() % MF + 5;
      printf("%d %d\n", x, y);
    }
  }

  return 0;
}
