Polygons
On a plane, you are given a set of N
polygons that meet the following criteria:
No two polygons share any points.
For each polygon
i
, there areP[i]
polygons that contain it, andN-1-P[i]
polygons that it contains, where0 ≤ P[i] ≤ N-1
.
Your task is to write a program that determines how many polygons each polygon is contained within.
Input
The first line of input contains an integer N
, representing the number of polygons, where 3 ≤ N ≤ 10000
. The following N
lines each describe one polygon. The (i+1)
-th line corresponds to the i
-th polygon and starts with an integer C[i]
, indicating the number of vertices in the polygon, where 3 ≤ C[i] ≤ 20
. This is followed by C[i]
pairs of integers, which are the coordinates of the vertices listed in the order they are traversed. The vertex coordinates are integers within the range -2000000000
to 2000000000
.
Output
The output should be a single line containing N
integers. The i
-th integer should be P[i]
, representing the number of polygons that contain the i
-th polygon.