SP7184 AXIS - Axis of Symmetry

Description

Given a point p and a line L on the plane, the reflection of p against L is a point q such that the segment pq is perpendicular to L and its middle point is on L. If p is on L, then p = q. Given a set of points on the plane, an 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 of the 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.

Input Format

The input contains several test cases, each one described in several lines. The first line of each test case contains an integer N indicating the number of points in the set (3 Each of the next N lines describes a different point of the set using two integers X and Y separated by a single space (−2000 of the point in the XY plane. You may assume that no two points of each test case have the same location. The last line of the input contains a single −1 and should not be processed as a test case.

Output Format

For each test case output a single line with an uppercase “Y” if there exists at least one axis of symmetry for the provided set of points, or an uppercase “N” otherwise.