'Roid Rage

Time limit1sMemory limit128 MB

Problem

When writing game programs, it is often useful to determine when two polygons intersect. This is especially handy in arcade games like Asteroids, where one polygon might represent a spaceship while another represents a huge, unyielding chunk of space rock.

Write a program that determines which polygons in a given set intersect one another.

Input

The first line contains a single integer $n$, the number of datasets. Each dataset has the following form:

  1. A line with a single positive integer $m$ ($1 \le m \le 10$), the number of polygons to analyze.
  2. $m$ lines, each describing one polygon (the first line is polygon 1, the second is polygon 2, and so on). Each line begins with a positive integer $v$ ($3 \le v \le 20$), the number of vertices of that polygon, followed by $v$ integer coordinate pairs written as x,y ($0 \le x, y \le 100$). The vertices are listed in order; consecutive vertices are joined by edges, and the last vertex is joined back to the first. Every polygon is simple — its edges never cross themselves.

Output

For each dataset, print the heading Data Set #z, where $z$ is 1 for the first dataset, 2 for the second, and so on. If the dataset contains no intersecting polygons, print no collisions on its own line. Otherwise, print every pair of intersecting polygons, one pair per line, writing the lower-numbered polygon first. List the pairs in ascending order, sorting first by the lower-numbered polygon and then by the higher-numbered one.

Two polygons intersect if they share an interior region (they overlap) or share boundary points (they touch at a single point or along an edge).