#include <bits/stdc++.h>
using namespace std;
const int MAX = 140000;
int sx[MAX + 10], ex[MAX], sy[MAX + 10], ey[MAX];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d %d %d %d", &sx[i], &sy[i], &ex[i], &ey[i]);
  vector<pair<int, int> > px, py;
  for (int i = 0; i < n; i++) {
    px.push_back(make_pair(sx[i], -i - 1));
    px.push_back(make_pair(ex[i], i + 1));
  }
  sort(px.begin(), px.end());
  set<int> rec;
  int rx = -1, ry = -1;
  for (int i = 0; i < (int)px.size(); i++) {
    if (px[i].second < 0) {
      rec.insert(-1 * px[i].second);
    } else {
      rec.erase(px[i].second);
    }
    if ((int)rec.size() >= n - 1) {
      py.clear();
      for (set<int>::iterator it = rec.begin(); it != rec.end(); it++) {
        py.push_back(make_pair(sy[*it - 1], -1 * (*it)));
        py.push_back(make_pair(ey[*it - 1], *it));
      }
      sort(py.begin(), py.end());
      int inter = 0;
      for (int j = 0; j < (int)py.size(); j++) {
        if (py[j].second < 0)
          inter++;
        else
          inter--;
        if (inter >= n - 1) rx = px[i].first, ry = py[j].first;
      }
    }
  }
  printf("%d %d\n", rx, ry);
}
