#t374. 寻找极大点
寻找极大点
Maximal Points
Problem Description
On a plane, consider two points and . We say that dominates if and .
Graphically, this means that lies in the infinite region whose upper-right corner is .
Given a set of points, there always exist some points that are not dominated by any point in the set; these are called the maximal points.
Write a program to find all maximal points and output their coordinates in increasing order of the -coordinate.
This problem guarantees: , and no point has a negative coordinate.
Input Format
The input consists of two lines.
The first line is a positive integer , the number of points.
The second line contains the coordinates of the points. All coordinate values are integers in the range to , and no two points in the input have the same coordinates.
Output Format
Output all maximal points in increasing order of the -coordinate.
The output format is: .
Note: consecutive points are separated by a ,, and there is no , after the last point. Outputting too few or too many points will be judged wrong.
Sample Input 1
5
1 2 2 2 3 1 2 3 1 4
Sample Output 1
(1,4),(2,3),(3,1)
Hint

Constraints
1s, 1024KiB for each test case.