p01277 Symmetry
Open Binary and Object Group organizes a programming contest every year. Mr. Hex belongs to this group and joins the judge team of the contest. This year, he created a geometric problem with its solution for the contest. The problem required a set of points forming a line-symmetric polygon for the input. Preparing the input for this problem was also his task. The input was expected to cover all edge cases, so he spent much time and attention to make them satisfactory.

However, since he worked with lots of care and for a long time, he got tired before he finished. So He might have made mistakes - there might be polygons not meeting the condition. It was not reasonable to prepare the input again from scratch. The judge team thus decided to find all line-asymmetric polygons in his input and fix them as soon as possible. They asked a programmer, just you, to write a program to find incorrect polygons.

You can assume the following:

* Edges of the polygon must not cross or touch each other except for the end points of adjacent edges.
* It is acceptable for the polygon to have adjacent three vertexes on a line, but in such a case, there must be the vertex symmetric to each of them.



Input

The input consists of a set of points in the following format.

N
x1 y1
x2 y2
...
xN yN


The first line of the input contains an integer N (3 ≤ N ≤ 1000), which denotes the number of points. The following N lines describe each point. The i-th line contains two integers x1, y1 (-10000 ≤ xi, yi ≤ 10000), which denote the coordinates of the i-th point.

Note that, although the points are the vertexes of a polygon, they are given in an artibrary order, not necessarily clockwise or counterclockwise.

Output

Output "Yes" in a line if the points can form a line-symmetric polygon, otherwise output "No".

Examples

Input

4
0 1
1 0
0 0
1 1


Output

Yes


Input

4
0 1
1 -1
0 0
1 1


Output

No


Input

9
-1 1
0 1
1 1
-1 0
0 0
1 0
-1 -1
0 -1
1 -1


Output

No


Input

3
-1 -1
0 0
1 1


Output

No


Input

4
0 2
0 0
-1 0
1 0


Output

Yes
```python
from collections import defaultdict
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def gcd(m, n):
    while n:
        m, n = n, m % n
    return m
def solve():
    N = int(readline())
    P = [list(map(int, readline().split())) for i in range(N)]
    ok = 0
    x0, y0 = P[0]; x1, y1 = P[1]
    for i in range(2, N):
        x2, y2 = P[i]
        if (x1 - x0) * (y2 - y0) != (x2 - x0) * (y1 - y0):
            ok = 1
            break
    if not ok:
        write("No\n")
        return
    A = defaultdict(int)
    B = defaultdict(int)
    for i in range(N):
        xi, yi = P[i]
        for j in range(i):
            xj, yj = P[j]
            dx = xi - xj; dy = yi - yj
            g = gcd(abs(dx), abs(dy))
            dx //= g; dy //= g
            if dy < 0:
                dx = -dx; dy = -dy
            if dx == 0:
                p = xi * dy - yi * dx; q = dy
                g = gcd(abs(p), abs(q))
                p //= g; q //= g
                if q < 0:
                    q = -q; p = -p
                key = (p, 0, q, dx, dy)
            else:
                p = yi * dx - xi * dy; q = dx
                g = gcd(abs(p), abs(q))
                p //= g; q //= g
                if q < 0:
                    q = -q; p = -p
                key = (0, p, q, dx, dy)
            A[key] += 1

            gx = -dy; gy = dx
            if gy < 0:
                gx = -gx; gy = -gy
            if dy == 0:
                p = dy * (yi + yj) + dx * (xi + xj)
                q = 2 * dx
                g = gcd(abs(p), abs(q))
                p //= g; q //= g
                if q < 0:
                    q = -q; p = -p
                key = (p, 0, q, gx, gy)
            else:
                p = dx * (xi + xj) + dy * (yi + yj)
                q = 2 * dy
                g = gcd(abs(p), abs(q))
                p //= g; q //= g
                if q < 0:
                    q = -q; p = -p
                key = (0, p, q, gx, gy)
            B[key] += 1
    ok = 0
    if N % 2 == 0:
        for k, v in B.items():
            if 2*v == N:
                ok = 1
                break
            if 2*v == N-2:
                if A[k] == 1:
                    ok = 1
                    break
    else:
        R = []
        for k, v in B.items():
            if 2*v+1 == N:
                R.append(k)
        ok = 0
        for x0, y0, z0, dx, dy in R:
            cnt = 0
            for x, y in P:
                if dy*(x*z0 - x0) == dx*(y*z0 - y0):
                    cnt += 1
            if cnt == 1:
                ok = 1
                break
    if ok:
        write("Yes\n")
    else:
        write("No\n")
solve()

```