#include <cstdio>
#include <utility>
#include <vector>

using namespace std;

const int maxa = 360000000;

unsigned long long lcgSeed = 301703;
int nextRnd( int l, int r )
{
  lcgSeed = lcgSeed * 23917 + 997;
  int res = (lcgSeed >> 16) % (r - l + 1) + l;
  return res;
}

void outputTest( vector <pair <int, int> > r, vector <int> a, int i_s, int j_s, int i_t, int j_t )
{
  printf("%u %u\n", r.size(), a.size());
  for (int i = 0; i < (int)r.size(); i++)
    printf("%d %d\n", r[i].first, r[i].second);
  for (int i = 0; i < (int)a.size(); i++)
    printf("%d\n", a[i]);
  printf("%d %d\n", i_s + 1, j_s + 1);
  printf("%d %d\n", i_t + 1, j_t + 1);
  puts("");
}

void randomTest( int n, int m, int maxr )
{
  vector <pair <int, int> > r;
  vector <int> a;
  for (int i = 0; i < n; i++)
  {
    int rad = nextRnd(1, maxr);
    int dir = nextRnd(-1, 1);
    r.push_back(make_pair(rad, dir));
  }
  for (int i = 0; i < m; i++)
    a.push_back(nextRnd(0, maxa - 1));
  int j_t = nextRnd(0, m - 1);
  int i_t = nextRnd(0, n - 1);
  int j_s = nextRnd(0, m - 1);
  int i_s = nextRnd(0, n - 1);
  outputTest(r, a, i_s, j_s, i_t, j_t);
}

void symmetricTest( int n, int m, int rkoef, int dir, int i_s = -1, int j_s = -1, int i_t = -1, int j_t = -1 )
{
  vector <pair <int, int> > r;
  vector <int> a;
  for (int i = 0; i < n; i++)
    r.push_back(make_pair((i + 1) * rkoef, dir < -1 ? nextRnd(-1, 1) : dir));
  for (int i = 0; i < m; i++)
    a.push_back((long long)i * maxa / m);
  i_s = i_s == -1 ? nextRnd(0, n - 1) : i_s;
  j_s = j_s == -1 ? nextRnd(0, m - 1) : j_s;
  i_t = i_t == -1 ? nextRnd(0, n - 1) : i_t;
  j_t = j_t == -1 ? nextRnd(0, m - 1) : j_t;
  outputTest(r, a, i_s, j_s, i_t, j_t);
}

int main()
{
  for (int i = 0; i < 20; i++)
  {
    int m = nextRnd(1, 15);
    int n = nextRnd(1, 15);
    randomTest(n, m, 100);
  }
  for (int n = 10; n <= 100000; n *= 100)
    for (int m = 10; m <= 100000; m *= 100)
    {
      randomTest(n, m, 1000000);
      int dm = nextRnd(0, m / 100);
      int dn = nextRnd(0, n / 100);
      randomTest(n - dn, m - dm, 1000000);
      symmetricTest(n, m, 1, -2);
      symmetricTest(n, m, 1000000 / n, -2);
    }
  symmetricTest(100000, 100000, 1, -2);
  symmetricTest(100000, 100000, 1, -1);
  symmetricTest(100000, 100000, 1, 0);
  symmetricTest(100000, 100000, 1, 1);
  symmetricTest(100000, 100000, 10, -2);
  randomTest(100000, 100000, 1000000);
  return 0;
}

