// The question of yesterday's competition, always thinking about it .. I can only understand what others think .. You are too stupid ..
// Select any two fruits, and select the two ends of the fruit to form a straight line to cut other fruits, that is, to determine whether the line and line segment are intersection (N ^ 3 * k ^ 3)
// Experience: After thinking about a method, think about it another way .. There must be divergent thinking ..
# Include <iostream>
Using namespace STD;
Struct point
{
Int X;
Int y;
};
Struct fruit
{
Point point [11];
Int K;
};
Fruit fruit [15];
Int judge (point P1, point P2, point P3, point P4) // the end point of a line segment is P1, P2, and two points on a straight line are P3, p4
{
Point TP1, TP2, TP3;
Tp1.x = p1.x-p3.x;
Tp1.y = p1.y-p3.y;
Tp2.x = p4.x-p3.x;
Tp2.y = p4.y-p3.y;
Tp3.x = p2.x-p3.x;
Tp3.y = p2.y-p3.y;
If (tp1.x * tp2.y-tp1.y * tp2.x) * (tp2.x * tp3.y-tp2.y * tp3.x)> = 0)
Return 1;
Else
Return 0;
}
Int main ()
{
Int t, n, I, j, H, G, Q, P;
Cin> T;
Int CAS = 0;
While (t --)
{
CAS ++;
Cin> N;
For (I = 0; I <n; I ++)
{
Cin> fruit [I]. K;
For (j = 0; j <fruit [I]. K; j ++)
{
Cin> fruit [I]. Point [J]. x> fruit [I]. Point [J]. Y;
}
}
Printf ("case % d:", CAS );
If (n = 1)
{
Printf ("1 \ n ");
Continue;
}
Int ans = 0;
Int max =-1;
For (I = 0; I <n; I ++) // The first two for values are enumerated for each of the two fruits.
For (j = I + 1; j <n; j ++)
For (G = 0; G <fruit [I]. K; G ++) // The vertices on the two fruits are enumerated ..
For (H = 0; H <fruit [J]. K; H ++)
{
Ans = 2;
For (q = 0; q <n; q ++) // then enumerate the line segments of other fruits and determine the line
{
If (q = I | q = J)
Continue;
For (P = 0; P <fruit [Q]. K-1; P ++)
{
If (Judge (fruit [Q]. point [p], fruit [Q]. point [p + 1], fruit [I]. point [g], fruit [J]. point [H])
{
Ans ++;
Break;
// Break directly if there is an intersection;
}
}
}
If (max <ans)
Max = ans;
}
Cout <max <Endl;
}
Return 0;
}