var
a,b,c,d,e,r,t,i,j,o,m,n:longint;
s,k,l:array[0..10000]of longint;
begin
assign(input,'table2.in');
assign(output,'table2.out');
reset(input);
rewrite(output);
read(a);
e:=0;
for b:=1 to a do
begin
read(s[b]);
for c:=1+e to s[b]+e do
begin
read(k[c],l[c]);
readln;
end;
e:=e+s[b];
end;
e:=0;
for b:=1 to a do
begin
o:=0;
for c:=1+e to s[b]+e do
begin
if (k[c]>10)and(k[c]<50)and(l[c]>10)and(l[c]<50) then
if sqr(k[c]-30)+sqr(l[c]-30)<400 then
o:=o+1;
if (k[c]>90)and(k[c]<110)and(l[c]>20)and(l[c]<40) then
if sqr(k[c]-100)+sqr(l[c]-30)<100 then
o:=o+2;
if (k[c]>165)and(k[c]<175)and(l[c]>25)and(l[c]<35) then
if sqr(k[c]-170)+sqr(l[c]-30)<25 then
o:=o+3;
end;
writeln(o);
e:=e+s[b];
end;
close(input);
close(output);
end.