To Mr. Solitarius, who is a famous solo play game creator, a new idea occurs like every day. His new game requires discs of various colors and sizes.
To start with, all the discs are randomly scattered around the center of a table. During the play, you can remove a pair of discs of the same color if neither of them has any discs on top of it. Note that a disc is not considered to be on top of another when they are externally tangent to each other.
For example, in Figure D-1, you can only remove the two black discs first and then their removal makes it possible to remove the two white ones. In contrast, gray ones never become removable.
You are requested to write a computer program that, for given colors, sizes, and initial placings of discs, calculates the maximum number of discs that can be removed.
The input consists of multiple datasets, each being in the following format and representing the state of a game just after all the discs are scattered.
n
x_{1} y_{1} r_{1} c_{1}
x_{2} y_{2} r_{2} c_{2}
...
x_{n} y_{n} r_{n} c_{n}
The first line consists of a positive integer n representing the number of discs. The following n lines, each containing 4 integers separated by a single space, represent the colors, sizes, and initial placings of the n discs in the following manner:
You may assume that every color index number is between 1 and 4, inclusive, and at most 6 discs in a dataset are of the same color. You may also assume that the x- and y-coordinates of the center of every disc are between 0 and 100, inclusive, and the radius between 1 and 100, inclusive.
The end of the input is indicated by a single zero.
For each dataset, print a line containing an integer indicating the maximum number of discs that can be removed.
4 0 0 50 1 0 0 50 2 100 0 50 1 0 0 100 2 7 12 40 8 1 10 40 10 2 30 40 10 2 10 10 10 1 20 10 9 3 30 10 8 3 40 10 7 3 2 0 0 100 1 100 32 5 1 0
2 4 0