#include <bits/stdc++.h>
using namespace std;
int x1[200010];
int x2[200010];
int yz1[200010];
int yz2[200010];
int n;
pair<pair<int, int>, pair<int, int> > pp[200010];
pair<pair<int, int>, pair<int, int> > qq[200010];
bool isValid(int x1, int y1, int x2, int y2) {
  if (x1 <= x2 && y1 <= y2) {
    return true;
  }
  return false;
}
pair<pair<int, int>, pair<int, int> > fn(int x1, int y1, int x2, int y2, int x3,
                                         int y3, int x4, int y4) {
  return make_pair(make_pair(max(x1, x3), max(y1, y3)),
                   make_pair(min(x2, x4), min(y2, y4)));
}
int main() {
  int INF = INT_MAX;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1[i] >> yz1[i] >> x2[i] >> yz2[i];
  }
  pp[0].first.first = x1[0];
  pp[0].first.second = yz1[0];
  pp[0].second.first = x2[0];
  pp[0].second.second = yz2[0];
  for (int i = 1; i < n; i++) {
    pair<pair<int, int>, pair<int, int> > uu;
    uu = fn(pp[i - 1].first.first, pp[i - 1].first.second,
            pp[i - 1].second.first, pp[i - 1].second.second, x1[i], yz1[i],
            x2[i], yz2[i]);
    if (isValid(uu.first.first, uu.first.second, uu.second.first,
                uu.second.second)) {
      pp[i] = uu;
    } else {
      pp[i] = make_pair(make_pair(INF, INF), make_pair(-INF, -INF));
    }
  }
  qq[n - 1].first.first = x1[n - 1];
  qq[n - 1].first.second = yz1[n - 1];
  qq[n - 1].second.first = x2[n - 1];
  qq[n - 1].second.second = yz2[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    pair<pair<int, int>, pair<int, int> > uu;
    uu = fn(qq[i + 1].first.first, qq[i + 1].first.second,
            qq[i + 1].second.first, qq[i + 1].second.second, x1[i], yz1[i],
            x2[i], yz2[i]);
    if (isValid(uu.first.first, uu.first.second, uu.second.first,
                uu.second.second)) {
      qq[i] = uu;
    } else {
      qq[i] = make_pair(make_pair(INF, INF), make_pair(-INF, -INF));
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (isValid(qq[1].first.first, qq[1].first.second, qq[1].second.first,
                  qq[1].second.second)) {
        cout << qq[1].first.first << " " << qq[1].first.second;
        return 0;
      }
    } else if (i == n - 1) {
      if (isValid(pp[n - 2].first.first, pp[n - 2].first.second,
                  pp[n - 2].second.first, pp[n - 2].second.second)) {
        cout << pp[n - 2].first.first << " " << pp[n - 2].first.second;
        return 0;
      }
    } else {
      pair<pair<int, int>, pair<int, int> > uu;
      uu = fn(qq[i + 1].first.first, qq[i + 1].first.second,
              qq[i + 1].second.first, qq[i + 1].second.second,
              pp[i - 1].first.first, pp[i - 1].first.second,
              pp[i - 1].second.first, pp[i - 1].second.second);
      if (isValid(uu.first.first, uu.first.second, uu.second.first,
                  uu.second.second)) {
        cout << uu.first.first << " " << uu.first.second;
        return 0;
      }
    }
  }
}
