Time limit
2s
Memory limit
128 MB
A person made a picture by marking several points on a sheet of paper. After finishing the picture, they wondered whether the picture could be folded once so that the marked positions on both sides coincide exactly.
The picture is symmetric if there exists a line such that, after folding the paper along that line, every position that has ever been marked on one side matches a marked position on the other side. The paper has no grain, so the fold line does not have to be perpendicular to the x-axis or the y-axis. The fold line also does not have to pass through the center of the paper. However, no marked point may lie on the fold line.
Given the marked point positions in the order they were drawn, write a program that determines whether the picture is symmetric.
The first line contains the number of data sets T (1 <= T <= 4).
For each data set, the first line contains the number of point markings N (1 <= N <= 700). Each of the next N lines contains the x- and y-coordinate of a marked point, in drawing order. Each coordinate is a real number whose absolute value is at most 10,000, and it is written with at most two digits after the decimal point.
The paper is considered to extend infinitely in every direction.
For each data set, print YES if the picture is symmetric, and NO otherwise.