시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 4 1 1 25.000%

문제

Shasita is drawing mandalas. First, she draws some circles, and then she colours the obtained regions.

Her younger sister Rice wants to help her drawing the mandalas. They agree Rice will draw the circles and Shasita will colour them. Shasita does not want to colour a very large number of all small regions and therefore she fixes the number of regions Rice should create by drawing the circles. Rice, on her side, is not very good at counting regions and she asks you to help her.

In this task you have to give the number of regions in a given mandala.

입력

The first line of the input file contains a single number: the number of test cases to follow. Each test case has the following format:

  • one line with the integer 0 ≤ n ≤ 500, the number of circles in this test case
  • n lines, each with the three integers xi, yi and ri, describing the ith circle, which has midpoint (xi, yi) and radius ri, with |xi| , |yi| ≤ 1000 and 0 < ri ≤ 1000.

출력

For every test case in the input file, the output should contain a single number, on a single line: the number of regions the circles divide the plane R2 in.

 

예제 입력

3
1
5 7 10
2
0 0 5
10 0 5
3
0 0 7
10 10 7
0 10 8

예제 출력

2
3
6

힌트