You were lucky enough to get a map just before entering the legendary magical mystery world. The map shows the whole area of your planned exploration, including several countries with complicated borders. The map is clearly drawn, but in sepia ink only; it is hard to recognize at a glance which region belongs to which country, and this might bring you into severe danger. You have decided to color the map before entering the area. "A good deal depends on preparation,"
you talked to yourself.
Each country has one or more territories, each of which has a polygonal shape. Territories belonging to one country may or may not "touch" each other, i.e. there may be disconnected territories. All the territories belonging to the same country must be assigned the same color. You can assign the same color to more than one country, but, to avoid confusion, two countries "adjacent" to each other should be assigned different colors. Two countries are considered to be "adjacent" if any of their territories share a border of non-zero length.
Write a program that finds the least number of colors required to color the map.
The input consists of multiple map data. Each map data starts with a line containing the total number of territories n, followed by the data for those territories. n is a positive integer not more than 100. The data for a territory with m vertices has the following format:
String
x1 y1
x2 y2
...
xm ym
-1
For each map data, output one line containing the least possible number of colors required to color the map satisfying the specified conditions.
6 Blizid 0 0 60 0 60 60 0 60 0 50 50 50 50 10 0 10 -1 Blizid 0 10 10 10 10 50 0 50 -1 Windom 10 10 50 10 40 20 20 20 20 40 10 50 -1 Accent 50 10 50 50 35 50 35 25 -1 Pilot 35 25 35 50 10 50 -1 Blizid 20 20 40 20 20 40 -1 4 A1234567890123456789 0 0 0 100 100 100 100 0 -1 B1234567890123456789 100 100 100 200 200 200 200 100 -1 C1234567890123456789 0 100 100 100 100 200 0 200 -1 D123456789012345678 100 0 100 100 200 100 200 0 -1 0
4 2