eolymp
bolt
Try our new interface for solving problems
Problems

Symmetry 2

Symmetry 2

\includegraphics{https://static.e-olymp.com/content/91/918b259eb57bababdcb41158b6c9f93be6d4f815.jpg} Given a point \textbf{p} and a line \textbf{L} on the plane, the reflection of \textbf{p} against \textbf{L} is a point \textbf{p^\{'\}} such that the segment \textbf{pp^\{'\}} is perpendicular to \textbf{L} and its middle point is on \textbf{L}. If \textbf{p} is on \textbf{L}, then \textbf{p^\{'\}} = \textbf{p}. Given a set of points on the plane, the axis of symmetry is a line on the plane such that the reflection of any point of the set against that line gives a point from this set. In this problem you are given a set of points on the plane, and you must decide whether there exists at least one axis of symmetry or not. Because of using real numbers, you may assume that the axis of symmetry is a line \textbf{L} such that for any point of the set \textbf{p} its reflection \textbf{p'} against the line \textbf{L} lies within \textbf{10^\{-6\}} distance of some point of the set. \InputFile The input contains several test cases. The first line of each input file contains an integer \textbf{K} (\textbf{1} <= \textbf{K} <= \textbf{10}) indicating the number of test cases. The first line of each test case contains an integer \textbf{N} indicating the number of points in the set (\textbf{1} <= \textbf{N} <= \textbf{100 000}). Each of the next \textbf{N} lines describes a single point of the set using two real numbers \textbf{X} and \textbf{Y} separated by a single space (\textbf{-10 000} <= \textbf{X}, \textbf{Y} <= \textbf{10 000}), these numbers represent the coordinates of the point on the plane. You may assume that no two points of each test case have the same location. It is guaranteed that the total sum of values of \textbf{N} for all test cases does not exceed \textbf{200 000}. \OutputFile For each test case output a single line \textbf{YES} if there exists at least one axis of symmetry for the provided set of points, or \textbf{NO} otherwise.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
3
4
-10 0
10 0
10 10
10 -10
4
-10 0
10 1
10 10.5
10 -10.5
6
-1000 30
-100 20
-10 10
1000 30
100 20
10 10
Output example #1
YES
NO
YES