program gen;

{$APPTYPE CONSOLE}

uses
  SysUtils;

const eps = 1e-5;

type point = record
       x, y: longint;
end;

var st, fn, be, en: point;
    test_num, i: integer;
    w, v: integer;

procedure print;
begin
  inc(test_num);
  if test_num < 10 then
    rewrite(output, '0' + inttostr(test_num))
  else
    rewrite(output, inttostr(test_num));
  writeln(fn.x, ' ', fn.y, ' ', be.x, ' ', be.y, ' ', en.x, ' ', en.y);
  writeln(w, ' ', v);
  close(output);
end;

procedure random_test(a: longint);
var x, y: real;
begin
  be.x := random(2 * a + 1) - a;
  be.y := random(a) + 1;
  en.x := random(2 * a + 1) - a;
  en.y := random(a) + 1;
  while (be.x = en.x) and (be.y = en.y) do
    begin
      en.x := random(2 * a + 1) - a;
      en.y := random(a) + 1;
    end;
  fn.x := random(2 * a + 1) - a;
  fn.y := random(a) + 1;
  x := (be.x - fn.x);
  y := (en.x - fn.x);
  while ((be.y = fn.y) and (en.y = fn.y) or
        ((be.y <> fn.y) and (en.y <> fn.y) and 
        (abs((x / (be.y - fn.y)) -
             (y / (en.y - fn.y))) < eps))) do
    begin
      fn.x := random(2 * a + 1) - a;
      fn.y := random(a) + 1;
    end;
  w := (random(50)+ 1); 
  v := (random(50)+ 1); 
  print;
end;

procedure test;
var dx, dy: longint;
begin
  be.x := random(18001) - 9000;
  be.y := random(8001) + 1000;
  en.x := random(18001) - 9000;
  en.y := random(8001) + 1000;
  while (be.x = en.x) and (be.y = en.y) do
    begin
      en.x := random(18001) - 9000;
      en.y := random(8001) + 1000;
    end;
  if abs((be.x- en.x)) =  abs(be.y - en.y) then
    inc(be.x);
  w := (random(50)+ 1);
  v := (random(50)+ 1);
  for dx := -1 to 1 do
    for dy := -1 to 1 do
      begin
        if (dx = 0) and (dy = 0) then continue;
        fn.x := be.x + (random(789) + 1) * dx;
        fn.y := be.y + (random(789) + 1) * dy;
        print;
      end;
  for dx := -1 to 1 do
    for dy := -1 to 1 do
      begin
        if (dx = 0) and (dy = 0) then continue;
        fn.x := en.x + (random(789) + 1) * dx;
        fn.y := en.y + (random(789) + 1) * dy;
        print;
      end;
end;
procedure maxtest;
begin
  fn.x := 0;   fn.y := 5001;
  be.x := 10000;   be.y := 1;
  en.x := -10000;  en.y := 10000;
  w := 1;      v :=1;
  print;
  fn.x := 0;       fn.y := 5010;
  be.x := 10000;   be.y := 1;
  en.x := -10000;  en.y := 10000;
  w := 1;     v :=50;
  print;
  fn.x := 10000;       fn.y := 10000;
  be.x := 10000;   be.y := 1;
  en.x := -10000;  en.y := 10000;
  w := 1;     v :=50;
  print;
end;

procedure gensimple;
begin
  fn.x := 0; fn.y := 3; 
  be.x := 0; be.y := 1;
  en.x := 0; en.y := 2;
  v := 4; w := 1;
  print;
  fn.x := 0; fn.y := 3; 
  be.x := -2; be.y := 1;
  en.x := 2; en.y := 1;
  v := 4; w := 1;
  print;


end;

procedure genmin;
begin
  fn.x := 10000;  fn.y := 1;
  be.x := 0; be.y := 1;
  en.x := 9950; en.y := 1;
  v := 50; w := 1;
  print;
  fn.x := 0;  fn.y := 1;
  be.x := 1; be.y := 1;
  en.x := 9996; en.y := 1;
  v := 50; w := 50;
  print;   
end;
  
begin
  randomize;
  RandSeed := 666777;
  test_num := 0;
  gensimple;
  genmin;
  for i := 1 to 10 do
    random_test(10);
  test;
  for i := 1 to 10 do
    random_test(200 * i);
  maxtest;
  for i := 1 to 10 do
    random_test(10000);
end.
