Under construction

Still being built. Things may change

Center of Symmetry

Interview

Time limit1sMemory limit128 MB

Summary
Decide whether a set of up to 10000 integer points has a center point such that every point's mirror image is also in the set.
Level

Medium4 of 10

Topics
Hash map, Geometry, Math, Array
Solved
No attempts yet

Problem

You are given a set of n distinct points with integer coordinates. Determine whether the set is centrally symmetric around some point.

The center does not have to be one of the given points. A point s is a center of symmetry if, for every point p in the set, there is also a point q in the same set such that p + q = 2s.

Input

The first line contains the number of test cases c.

For each test case, the first line contains the number of points n. (1 <= n <= 10000)

The next n lines each contain two integers x and y, the coordinates of one point. All points are distinct, and -10000000 <= x, y <= 10000000.

Output

For each test case, print yes if the given point set has a center of symmetry, and no otherwise.

Examples1

  1. Example 1

    Input
    1
    8
    1 10
    3 6
    6 8
    6 2
    3 -4
    1 0
    -2 -2
    -2 4
    
    Expected output
    yes