ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural SU contest. Petrozavodsk training camp. Summer 2008

About     Problems     Submit solution     Judge status     Standings
Contest is over

J. Scrooge's Tower

Time limit: 0.5 second
Memory limit: 64 MB
Scrooge McDuck owns a circular island of radius R centered at the origin. He wants to build a square tower there to keep all his wealth. The wealth is quite huge, so the square of the foundation should be inscribed in the circle of the island. After reading a lot of popular magazines, Mrs. Beakley claimed that according to feng shui, the entrance to the tower should be situated at the point (x1y1), and the exit should be at the point (x2y2). Of course, entrance and exit points should lie on the border of tower's foundation. Scrooge told you all these numbers and wants to know if it is possible to satisfy Mrs. Beakley's requirements.

Input

The first line contains an integer T — the number of test cases (1 ≤ T ≤ 1000). Each of the next T lines contains five integers separated by spaces: R, x1, y1, x2, y2. 1 ≤ R ≤ 10000. Points (x1y1) and (x2y2) are situated inside the circle.

Output

For each of the T cases output “YES” if the tower can be built, and “NO” otherwise.

Sample

inputoutput
3
2 1 1 1 -1
2 1 1 0 0
1 1 0 -1 0
YES
NO
YES
Problem Author: folklore
Problem Source: Ural SU Contest. Petrozavodsk Summer Session, August 2008
To submit the solution for this problem go to the Problem set: 1679. Scrooge's Tower