Tunb Airline#6905

Tunb Airline

1 seconde
64 mégaoctets
Très difficile

Tunb airline has several flight plans in the Persian Gulf in which there are several beautiful islands. Each flight path looks like a polygonal path on a 2D map starting at one island and ending at another island as depicted in the figure. Recently, the airline has decided to determine how much safe its flights are. For a flight plan, one of the safety measures to be determined is to find out the maximum of dangerousness() over all points on the flight path where dangerousness () is the minimum Euclidean distance of to islands located in the Persian Gulf. If this measure is low, the chance of surviving is high if an incident happens. Your job is to compute this safety measure for a given flight plan.

Entrée

There are multiple test cases in the input. Each test case starts with a line containing two non-negative integers and (0 \le n, m \le 20), where is the number of islands in the Persian Gulf and is the number of vertices of the flight path. Then it is followed by lines each containing two coordinates of the path vertices from first to last. Finally each test case is terminated with the description of islands which are disjoint polygons. For each polygon, first the number of vertices, , appears in a line ( is at least and at most ). In the next lines, the coordinates of the vertices of the polygon is given in either clockwise or counter-clockwise order; each line containing two integers. All coordinates are within range and . The input finishes with a line containing "0 0" (omit the quotes) which should not be processed as a test case.

Sortie

For each test case, output the safety measure defined above rounded to exactly three digits after the decimal point.

Exemples

Exemple 1

Loading
Loading