#P1949I. Disks

    ID: 9070 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>dfs and similargeometrygraph matchingsgraphs

Disks

No submission language available for this problem.

Description

You are given nn disks in the plane. The center of each disk has integer coordinates, and the radius of each disk is a positive integer. No two disks overlap in a region of positive area, but it is possible for disks to be tangent to each other.

Your task is to determine whether it is possible to change the radii of the disks in such a way that:

  • Disks that were tangent to each other remain tangent to each other.
  • No two disks overlap in a region of positive area.
  • The sum of all radii strictly decreases.
The new radii are allowed to be arbitrary positive real numbers. The centers of the disks cannot be changed.

The first line contains an integer nn (1n10001\le n \le 1000) — the number of disks.

The next nn lines contain three integers each. The ii-th of such lines contains xix_i, yiy_i (109xi,yi109-10^9 \leq x_i, y_i \leq 10^9), and rir_i (1ri1091 \leq r_i \leq 10^9) — the coordinates of the center, and the radius, of the ii-th disk.

Print YES\texttt{YES} if it is possible to change the radii in the desired manner. Otherwise, print NO\texttt{NO}.

Input

The first line contains an integer nn (1n10001\le n \le 1000) — the number of disks.

The next nn lines contain three integers each. The ii-th of such lines contains xix_i, yiy_i (109xi,yi109-10^9 \leq x_i, y_i \leq 10^9), and rir_i (1ri1091 \leq r_i \leq 10^9) — the coordinates of the center, and the radius, of the ii-th disk.

Output

Print YES\texttt{YES} if it is possible to change the radii in the desired manner. Otherwise, print NO\texttt{NO}.

Sample Input 1

5
0 2 1
0 0 1
4 -3 4
11 0 3
11 5 2

Sample Output 1

YES

Sample Input 2

4
2 2 2
7 2 3
7 7 2
2 7 3

Sample Output 2

NO

Note

In the first sample, one can decrease the radii of the first and third disk by 0.50.5, and increase the radius of the second disk by 0.50.5. This way, the sum of all radii decreases by 0.50.5. The situation before and after changing the radii is depicted below.

First sample (left) and a valid way to change the radii of the disks (right).

In the second sample, depicted below, there is no way to change the radii of the disks in the desired manner.

Second sample.