(*--------------------------------------------------------------*)
(* ACM ICPC 2007-2008                                           *)
(* Northeastern European Regional Contest                       *)
(* St Petersburg - Barnaul - Tashkent - Batumi, November 28, 200*)
(*--------------------------------------------------------------*)
(* Problem K. Kingdom Partitioning                              *)
(*--------------------------------------------------------------*)
(* Solution                                                     *)
(*                                                              *)
(* Author                Petr Mitrichev                         *)
(*--------------------------------------------------------------*)
 
{$APPTYPE CONSOLE}
{$R+,Q+,S+,I+,H+,O-}

Program pk;

uses
  Math, SysUtils;

Const
  TaskID='kingdom';
  InFile=TaskID+'.in';
  OutFile=TaskID+'.out';
  MaxN=30;
  MaxM=30;

Type
  Real=Extended;

Var
  N:Integer;
  X,Y,R:Array[1..MaxN,1..MaxM]Of Real;
  X1,X2:Array[1..MaxN]Of Real;
  M:Array[1..MaxN]Of Integer;
  Area:Array[1..MaxN]Of Real;
  U:Array[1..MaxN]Of Boolean;

Procedure Load;
Var
  I,J:Integer;
Begin
  Read(N);
  For I:=1 To N Do Begin
    Read(M[I]);
    For J:=1 To M[I] Do read(X[I,J],Y[I,J],R[I,J]);
  End;
End;

Function Part(I,J:Integer; XX:Real):Real;
Var
  Alpha:Real;
Begin
  XX:=XX-X[I,J];
  If XX<=-R[I,J] Then Result:=0 Else If XX>=R[I,J] Then Result:=Pi*R[I,J]*R[I,J] Else Begin
    Alpha:=ArcCos(Abs(XX)/R[I,J]);
    Result:=R[I,J]*R[I,J]*(Alpha-Sin(Alpha*2)/2);
    If XX>0 Then Result:=Pi*R[I,J]*R[I,J]-Result;
  End;
End;

Function PartAr(I:Integer; X:Real):Real;
Var
  J:Integer;
Begin
  Result:=0;
  For J:=1 To M[I] Do Result:=Result+Part(I,J,X);
  Result:=Result/Area[I];
End;

Procedure Solve;
Var
  L,R,Med,PX:Real;
  I,J:Integer;
  Ok:Boolean;
Begin
  FillChar(Area,SizeOf(Area),0);
  For I:=1 To N Do
    For j:=1 To M[I] Do
      Area[I]:=Area[I]+Pi*pk.R[I,J]*pk.R[I,J];
  FillChar(U,SizeOf(U),False);
  PX:=-2000;
  For I:=1 To N Do Begin
    If I=N Then R:=2000 Else Begin
      L:=PX;
      R:=2000;
      While (R-L>1e-12) Do Begin
        Med:=(L+R)/2;
        Ok:=False;
        For J:=1 To N Do If Not U[J] And (PartAr(J,Med)>I/N) Then Ok:=True;
        If Ok Then R:=Med Else L:=Med;
      End;
    End;
    For J:=1 To N Do If Not U[J] And ((I=N) Or (PartAr(J,R)>I/N)) Then Begin
      U[J]:=True;
      X1[J]:=PX;
      X2[J]:=R;
      Break;
    End;
    PX:=R;
  End;
End;

Procedure Save;
Var
  I:Integer;
Begin
  For I:=1 To N Do Begin
    WriteLn(4);
    WriteLn(X1[I]:0:20,' -2000');
    WriteLn(X1[I]:0:20,' 2000');
    WriteLn(X2[I]:0:20,' 2000');
    WriteLn(X2[I]:0:20,' -2000');
  End;
End;

begin
  Load;
  Solve;
  Save;
end.
 