#include <bits/stdc++.h>
using namespace std;
struct rec {
  pair<int, int> bl;
  pair<int, int> ur;
  bool isrect;
} rect[132680], pre[132680], suf[132680];
rec intersection(rec& a, rec& b) {
  rec ans;
  ans.bl.first = max(a.bl.first, b.bl.first);
  ans.bl.second = max(a.bl.second, b.bl.second);
  ans.ur.first = min(a.ur.first, b.ur.first);
  ans.ur.second = min(a.ur.second, b.ur.second);
  if (ans.bl.first > ans.ur.first || ans.bl.second > ans.ur.second)
    ans.isrect = 0;
  else
    ans.isrect = 1;
  if (a.isrect == 0 || b.isrect == 0) {
    ans.isrect = 0;
  }
  return ans;
}
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> rect[i].bl.first >> rect[i].bl.second;
    cin >> rect[i].ur.first >> rect[i].ur.second;
    rect[i].isrect = 1;
  }
  pre[0] = rect[0];
  for (int i = 1; i < n; i++) {
    pre[i] = intersection(pre[i - 1], rect[i]);
  }
  suf[n - 1] = rect[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    suf[i] = intersection(suf[i + 1], rect[i]);
  }
  for (int i = 0; i < n; i++) {
    rec ans;
    ans.bl = make_pair((int)-1000000000, (int)-1000000000);
    ans.ur = make_pair((int)1000000000, (int)1000000000);
    ans.isrect = 1;
    if (i > 0) {
      ans = pre[i - 1];
    }
    if (i < n - 1) {
      ans = intersection(ans, suf[i + 1]);
    }
    if (ans.isrect) {
      cout << (int)ans.bl.first << " " << (int)ans.bl.second << endl;
      return 0;
    }
  }
  return 0;
}
