#K60132. Perfect Circle Detection

    ID: 31019 Type: Default 1000ms 256MiB

Perfect Circle Detection

Perfect Circle Detection

Given a set of points in a 2D plane, your task is to determine whether all of them lie on a perfect circle centered at the origin. More formally, given coordinates \( (x_i, y_i) \) for \( i=1,2,\dots,N \), you need to check if the Euclidean distance of every point from the origin is the same. In mathematical terms, check if there exists a constant \( R \) such that for every point, \( \sqrt{x_i^2+y_i^2} = R \) within a tolerance of \(10^{-6}\). Output "YES" if the points lie on such a circle, and "NO" otherwise.

inputFormat

The input starts with an integer \( T \) representing the number of test cases. For each test case, the first line contains an integer \( N \) denoting the number of points. The next \( N \) lines each contain two space-separated integers representing the \( x \) and \( y \) coordinates of a point.

Input Format:

T
N
x1 y1
x2 y2
... 
N
x1 y1
x2 y2
...

outputFormat

For each test case, output a single line containing "YES" if all points lie on a perfect circle centered at the origin, or "NO" otherwise.

Output Format: For each test case, output the result on a new line.

## sample
2
4
1 1
-1 -1
-1 1
1 -1
3
0 2
2 2
-2 -2
YES

NO

</p>