//弱鸡分享一下自己带吗
//第一题AC0.6
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct po { int x;  int y;  };
bool comparex(po a, po b){
return a.x<b.x ? true : false;
}
int main(){
int N;
cin >> N;
vector<po> P;
vector<int> yp;
po temp;
for (int i = 0; i<N; i++){ cin >> temp.x >> temp.y; P.push_back(temp); yp.push_back(temp.y); }
sort(P.begin(), P.end(), comparex);
sort(yp.begin(), yp.end());
vector<po> res;
for (int i = 0; i<N - 1; i++){
vector<int>::iterator ty_it = find(yp.begin(), yp.end(), P[i].y);
yp.erase(ty_it);
if (P[i].y>yp[yp.size() - 1]) res.push_back(P[i]);
}
res.push_back(P[N - 1]);
for (int i = 0; i<res.size(); i++) cout << res[i].x << " " << res[i].y << endl;
system("pause");
return 0;
}

//第二题AC0.5
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n, temp;
cin >> n;
vector<int> num;
for (int i = 0; i<n; i++){ cin >> temp; num.push_back(temp); }
int res = 0, tempres, curto, curmin;
for (int i = 0; i<n; i++){
curto = num[i];
curmin = num[i];
tempres = num[i] * num[i];
for (int j = i + 1; j<n; j++){
curmin = curmin<num[j] ? curmin : num[j];
curto += num[j];
tempres = tempres>curto*curmin ? tempres : curto*curmin;
}
res = res>tempres ? res : tempres;
}
cout << res << endl;
system("pause");
return 0;
}