Partitioning the plane

SPOJ - PARTPLNE