Counting Communication Groups

No attempts yetTime limit8sMemory limit256 MB

Problem

There are NN enemy camps on a two-dimensional plane. Each camp builds one communication tower, and the tower of camp ii takes every point within distance RiR_i of its position as its communication area AiA_i.

If the areas AiA_i and AjA_j touch or overlap, camp ii and camp jj communicate directly. Even without a direct link, two camps count as able to communicate when a chain of direct links connects them through other camps.

Camps that can communicate with each other move as one group. Count how many such groups there are.

Input

The first line contains the number of test cases TT. The TT test cases follow.

The first line of each test case contains the number of enemy camps NN (1N30001 \le N \le 3000). Each of the next NN lines contains the coordinates xx, yy (0x,y50000 \le x, y \le 5000) of a camp and the radius RR (0R50000 \le R \le 5000) of its tower. All given numbers are integers.

Output

For each test case, print the number of groups of enemy camps on one line.