Well-Oiled Machine

View as PDF

Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type

Well-Oiled Machine

As the greatest inventor in Adelaide, you love building little contraptions out of cogs. However, it's hard to tell what they'll do until you put them together!

Your designs contain N cogs, repreesented by circles with position (X,Y) and radius R. Any cogs that are touching or intersecting will spin in opposite directions.

However, some arrangements of cogs can't spin, because they are being pulled two different ways. For example, a circle of three cogs can't spin:

For any given design of cogs, are all of the cogs able to spin?

Input

The first line of each test case contains an a single integer N (1 \leq N \leq 1000), the number of cogs in your design.

The next N lines contain 3 integers X Y R, indicating that there is a cog at the position (X, Y) with radius R. 1 \leq X, Y, R \leq 10^8.

Output

For each test case, print "Yes" if all the cogs are able to spin, and "No" if they can't.

Note: It's possible that not all cogs in a test case are touching/intersecting.

Note: It's impossible for one cog to be completely inside another.

Example

Input
5
1 1 1
3 2 2
5 1 1
6 1 1
7 6 1
Output
Yes

See the diagram below for a picture of the cogs. All the red ones can spin clockwise, and all the blue ones can spin counterclockwise.

Example

Input
3
1 1 2
3 2 2
2 3 2
Output
No


Comments

There are no comments at the moment.