提示: 欢迎访问OurACM平台。
Problem 2035 Axial symmetry

Accept: 247    Submit: 980
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Axial symmetry is so beautiful. We can find many axial symmetric objects in everyday life. Following are some axial symmetric figures.

Now, you are given a simple polygon. A simple polygon is a closed polygonal chain of line segments in the plane which do not have points in common other than the common vertices of pairs of consecutive segments.

To simplify the problem, the given simple polygon in this problem is special. All edges of the given polygon parallel to either X-axis or Y-axis. Your task is to examine whether the given polygon is axial symmetric.

Input

The first line of the input contains an integer T(T≤50), indicating the number of test cases. Each case begins with one integer n(10≤n≤500), the number of points. The next n lines indicate the points of the polygon, each with two integers x(-100,000≤x≤100,000) and y(-100,000≤y≤100,000). The points would be given either clockwise or counterclockwise.

Output

For each test case, print a line containing the test case number (beginning with 1) and if the polygon is axial symmetric, please output “YES”, or you should output “NO”.

Sample Input

2 4 0 0 0 1 1 1 1 0 6 0 0 4 0 4 2 1 2 1 4 0 4

Sample Output

Case 1: YES Case 2: NO

Source

2011年全国大学生程序设计邀请赛(福州)

Submit  Back  Status  Discuss