Constellations

No attempts yetTime limit1sMemory limit128 MB

Problem

One night, while camping out under the open sky, Big Ed was gazing at the stars. Ed had never bothered to learn the constellations, but he decided that grouping the stars together was a sensible thing to do. Being methodical, he settled on the following simple rules:

  • Every star belongs to the same constellation as its closest neighbor.
  • If the closest neighbor is not unique, then the star and all of its closest neighbors belong to the same constellation.
  • If A is in the same constellation as B, then B is in the same constellation as A.
  • If A is in the same constellation as B, and B is in the same constellation as C, then A is in the same constellation as C.

Here, "closest" is measured by the ordinary Euclidean distance between the two stars' coordinates.

For example, if the sky looked like the following:

then there are 3 constellations: {1, 2, 3, 4, 5}, {6, 7, 8}, {9, 10}.

Input

The input consists of a sequence of sky descriptions. Each description begins with a line containing a single integer $n$ ($0 < n \le 500$), the number of stars.

The next $n$ lines each give the coordinates of one star as two integers $x$ and $y$ ($0 \le x, y \le 1000$).

A line containing $n = 0$ marks the end of the input.

Output

For each sky description, print a single line of the form

Sky s contains c constellations.

where $s$ is the number of the sky description (starting from 1) and $c$ is the number of constellations.