1 #include<bits/stdc++.h>
2 using namespace std;
3 struct node{
4 int x,y;
5 }a[300];
6 int N;
7 int cmp(const node&w,const node&e){
8 if(w.x>e.x) return 1;
9 else if(w.x==e.x){
10 if(w.y>e.y) return 1;
11 }
12 return 0;
13 }
14 int tot;
15 int ansx[300];
16 int ansy[300];
17 int maxy;
18 int main(){
19 scanf("%d",&N);
20 for(int i=1;i<=N;i++){
21 scanf("%d%d",&a[i].x,&a[i].y);
22 }
23 sort(a+1,a+N+1,cmp);
24 for(int i=1;i<=N;i++){
25 if(a[i].y>maxy){
26 maxy=a[i].y;
27 tot++;
28 ansx[tot]=a[i].x;
29 ansy[tot]=a[i].y;
30 }
31 }
32 for(int i=tot;i>=2;i--){
33 cout<<"("<<ansx[i]<<","<<ansy[i]<<")"<<",";
34 }
35 cout<<"("<<ansx[1]<<","<<ansy[1]<<")";
36 return 0;
37 }