#include <bits/stdc++.h>
using namespace std;
map<int, int> m; // x,y
int n, a[105], b[105];
int main()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i] >> b[i];
for (int j = 1; j < i; j++)
if (a[i] >= a[j] && b[i] >= b[j])
a[j] = b[j] = 0;
else if (a[i] <= a[j] && b[i] <= b[j])
a[i] = b[i] = 0;
}
for (int i = 1; i <= n; i++)
m[a[i]] = b[i];
string ans = "";
for (int i = 1; i <= 100; i++)
if (m[i])
ans += "(" + to_string(i) + "," + to_string(m[i]) + "),";
ans.resize(ans.size() - 1);
cout << ans;
return 0;
}