ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

Ural Championship 2010

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Circular Strings

Time limit: 0.5 second
Memory limit: 64 MB
A growing number of people accept nowadays the theory of strings and superstrings and of the mirror world. One of the most interesting objects of study within this theory is circular strings. They can be used for traveling between worlds: flying through the ring of such a string, an observer finds himself in the mirror world, which can have entirely different stars, galaxies, and, possibly, life. The traveler can return to his world by flying backward through the same or any other circular string. Unfortunately, superstrings are unstable. Gradually losing their energy, they contract and eventually explode when their diameter decreases to the diameter of an elementary particle. Which means that a travel to the mirror world is potentially dangerous.
Circular strings also have a practical application. They can be used to draw any regular polygon without ruler or compasses. For this, a string should be made to oscillate exactly in a plane at one of its resonance frequencies. In this situation, several points of the string stay fixed. According to the theory, these points are vertices of the required polygon. Physicists have just made such an experiment and now ask you to analyze the results.
You are given n pairs of real numbers. The physicists claim that these are the coordinates of vertices of a nondegenerate n-gon written in the traversal order.

Input

The first line contains the integer n (3 ≤ n ≤ 100). The i-th of the following n lines contains real numbers xi and yi separated with a space (0 ≤ xi, yi ≤ 1); these numbers are the coordinates of the i-th point. The coordinates of different points may coincide, but it is guaranteed that there exists at least one pair of points at a distance of at least 0.3. The coordinates are given with accuracy of at least 10−10.

Output

If the experiment didn't produce vertices of a regular n-gon in the traversal order, output “NO”. Otherwise, output “YES”. It is guaranteed that in the case of the negative answer the coordinates of the points can't be changed by less than 10−5 so that they become the coordinates of vertices of a regular n-gon written in the traversal order.

Samples

inputoutput
4
0 0
1 0
1 1
0 1
YES
3
0 0
1 0
0.5 1
NO
Problem Author: Dmitry Ivankov
Problem Source: The 14th Urals Collegiate Programing Championship, April 10, 2010
To submit the solution for this problem go to the Problem set: 1768. Circular Strings