#include <bits/stdc++.h>
using namespace std;
struct cmp {
  bool operator()(long long a, long long b) { return a > b; }
};
multiset<long long> mex, msy;
multiset<long long, cmp> msx, mey;
int main() {
  long long n;
  cin >> n;
  long long sx[n], ex[n], sy[n], ey[n];
  for (long long i = 0; i < n; i++) {
    cin >> sx[i] >> ey[i] >> ex[i] >> sy[i];
    msx.insert(sx[i]);
    mex.insert(ex[i]);
    msy.insert(sy[i]);
    mey.insert(ey[i]);
  }
  for (long long i = 0; i < n; i++) {
    msx.erase(msx.find(sx[i]));
    mex.erase(mex.find(ex[i]));
    msy.erase(msy.find(sy[i]));
    mey.erase(mey.find(ey[i]));
    if (*msx.begin() <= *mex.begin() && *msy.begin() >= *mey.begin()) {
      cout << *msx.begin() << " " << *msy.begin() << endl;
      return 0;
    }
    msx.insert(sx[i]);
    mex.insert(ex[i]);
    msy.insert(sy[i]);
    mey.insert(ey[i]);
  }
}
