{$I-,Q-,R-,S-}
program Trees;
  var
    a:array [1..20,1..50,1..50] of byte;
    d:array [1..20,1..50] of byte;
    b:array [1..20,1..50] of byte;
    nn:array [1..20] of byte;
    k,i,j,x,y,sg,o:longint;
function rec(ii:byte):byte;
  var
    tt:byte;
    aa:array[0..10] of boolean;
  begin
    for tt:=0 to 10
      do aa[tt]:=false;
    for tt:=1 to b[j,ii]
      do begin
           d[j,a[j,ii,tt]]:=rec(a[j,ii,tt]);
           aa[d[j,a[j,ii,tt]]]:=true;
         end;
    tt:=0;
    while aa[tt]
      do tt:=tt+1;
    rec:=tt;
  end;
Begin
  read(k);
  for j:=1 to k
    do begin
         read(nn[j]);
         for i:=1 to nn[j]-1
           do begin
                read(x,y);
                b[j,x]:=b[j,x]+1;
                a[j,x,b[j,x]]:=y;
              end;
       end;
  for j:=1 to k
    do d[j,1]:=rec(1);
  sg:=0;
  for j:=1 to k
    do sg:=sg xor d[j,1];
  o:=0;
  if sg=0
    then begin
           for j:=1 to k
             do if d[j,1]>0
                  then o:=o+1;
           writeln(2,' ',o);
         end
    else begin
           for j:=1 to k
             do for i:=1 to b[j,1]
                   do if (sg xor d[j,1] xor d[j,a[j,1,i]])=0
                        then o:=o+1;
           writeln(1,' ',o);
         end;
End.
