{$APPTYPE CONSOLE}
var j1,max,sk,t,i,n,m,j,a5,a6,a7,a8,a1,a2,a3,a4,b1,b2,b3,b4,b5,b6,b7,b8,x,y:integer;
    k1,k2,k3,k4,x1,y1:array[1..1000] of real;
begin
  assign(input, 'HUNTER.IN'); reset(input);
  readln(t);
  for i:=1 to t do
  begin
   b1:=0; b2:=0; b3:=0; b4:=0;
   b5:=0; b6:=0; b7:=0; b8:=0;
   a1:=1; a2:=1; a3:=1; a4:=1;
   a5:=0; a6:=0; a7:=0; a8:=0;
   readln(n);
   for j:=1 to n do begin
    readln(x,y);
    x1[j]:=x; y1[j]:=y;
    for j1:=1 to j do begin
      if j1<>j then if (x=x1[j1]) and (y=y1[j1]) then begin x:=0; y:=0; end;end;
    if (x>0) and (y>0) then begin k1[a1]:=x/y; a1:=a1+1; end;
    if (x<0) and (y>0) then begin k2[a2]:=x/y; a2:=a2+1; end;
    if (x<0) and (y<0) then begin k3[a3]:=x/y; a3:=a3+1; end;
    if (x>0) and (y<0) then begin k4[a4]:=x/y; a4:=a4+1; end;
    if (x=0) and (y>0) then b5:=b5+1;
    if (x=0) and (y<0) then b6:=b6+1;
    if (x>0) and (y=0) then b7:=b7+1;
    if (x<0) and (y=0) then b8:=b8+1;
    if (x>0) and (x=y) then a5:=a5+1;
    if (x<0) and (x=y) then a6:=a6+1;
    if (y<0) and (y=x) then a7:=a7+1;
    if (y>0) and (y=x) then a8:=a8+1;
   end;
   if a1>0 then
    for j:=1 to a1-1 do
     begin
     for j1:=1 to a1-1 do
      if j1<>j then
       if k1[j]=k1[j1] then sk:=sk+1;
     if sk>b1 then b1:=sk;
     sk:=0;
     end;
   if a2>0 then
    for j:=1 to a2-1 do
     begin
     for j1:=1 to a2-1 do
      if j1<>j then
       if k2[j]=k2[j1] then sk:=sk+1;
     if sk>b2 then b2:=sk;
     sk:=0;
     end;
   if a3>0 then
    for j:=1 to a3-1 do
     begin
     for j1:=1 to a3-1 do
      if j1<>j then
       if k3[j]=k3[j1] then sk:=sk+1;
     if sk>b3 then b3:=sk;
     sk:=0;
     end;
   if a4>0 then
    for j:=1 to a4-1 do
     begin
     for j1:=1 to a4-1 do
      if j1<>j then
       if k4[j]=k4[j1] then sk:=sk+1;
     if sk>b4 then b4:=sk;
     sk:=0;
     end;
    max:=0;
    if b1>max then max:=b1;
    if b2>max then max:=b2;
    if b3>max then max:=b3;
    if b4>max then max:=b4;
    if a5>max then max:=a5;
    if a6>max then max:=a6;
    if a7>max then max:=a7;
    if a8>max then max:=a8;
    if b5>max then max:=b5;
    if b6>max then max:=b6;
    if b7>max then max:=b7;
    if b8>max then max:=b8;
    writeln(max);
   end;
end.