// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 1e-9
#define pi 3.1415926535898
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
#define uint unsigned int
// mylittlepony
using namespace std;
 
int main() {
    cin.sync_with_stdio(0);
    int N;
    cin >> N;
    set< pair<int,int> > S;
    set<int> X,Y;
    vector<int> maxY(50000+tisic,0);
    for(int i =0; i < N; i++) {
        int x,y;
        cin >> x >> y;
        maxY[x] =max(maxY[x],y);
        S.insert(make_pair(x,y));
        X.insert(x);
        Y.insert(y);}
 
    ALL_THE(X,it) ALL_THE(Y,jt)
        if(S.find(make_pair(*it,*jt)) == S.end() && maxY[*it] > *jt)
            cout << *it << " " << *jt << "\n";
    return 0;}
 
// look at my code
// my code is amazing