S.O.S.

If you want to know why the name of this problem is S.O.S., go to ce.aut.ac.ir/∼sos ;-) There are some fiery buildings in a city and fire fighters are trying to control the fire. But the speed of propagation of fire is more than what can be controlled. Fire fighters discovered that if they only extinguish the boundary of a fire zone, it can be controlled better. To do this, they must know how fire spreads. Here is the description of fire propagation process and structure of buildings: • A fiery building ignites its neighbors after T cycles. • T is ceiling(10 ∗ a/b), where a is the area of non-fired building and b is the area of ignited one. • Two buildings are neighbor if their minimum distance be less than 30 (meters). • Each building is a non-self-intersecting polygon. • Buildings neither overlap nor touch each other. Input First line of input contains an integer T, which is the number of test cases, and after that there are T test cases. Each test case starts with a number 0 < M ≤ 100, the number of buildings. After that, there are M lines each containing an integer 3 ≤ L ≤ 33 followed by L pair of integers Xi and Yi (−1000 ≤ Xi,Yi ≤ 1000) as the building apexes in a line (either in clockwise or counter clockwise direction). After that, there is an integer 0 ≤ P < M representing that the P -th building is ignited in Cycle = 0. Then there is an integer Cycle (0 ≤ Cycle ≤ 300). There is a blank line after each test case. Output For each test case, your program must print the indices of ignited buildings in cycle = Cycle in increasing order in a single line separated by a single space. It should be noted that two floating point numbers a and b assumed equal if their absolute difference is less than 10−8. Note. Buildings are numbered from 0 to M − 1 in the order they appear in the input. Sample Input 1 4 400011110 3223233 4 21 0 22 0 22 1 21 1 3 33 2 33 3 34 3 0 7 Sample Output 01