#include <bits/stdc++.h>
using namespace std;
int plowx[400005], phighx[400005], plowy[400005], phighy[400005], slowx[400005],
    slowy[400005], shighx[400005], shighy[400005];
vector<pair<pair<int, int>, pair<int, int> > > v;
int main() {
  int n;
  scanf("%d", &n);
  v.push_back(make_pair(make_pair(0, 0), make_pair(0, 0)));
  for (int i = 1; i <= n; i++) {
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    v.push_back(make_pair(make_pair(x1, y1), make_pair(x2, y2)));
    if (i == 1) {
      plowx[i] = x1;
      phighx[i] = x2;
      plowy[i] = y1;
      phighy[i] = y2;
    } else {
      plowx[i] = max(plowx[i - 1], x1);
      phighx[i] = min(phighx[i - 1], x2);
      plowy[i] = max(plowy[i - 1], y1);
      phighy[i] = min(phighy[i - 1], y2);
    }
  }
  for (int i = v.size() - 1; i > 0; i--) {
    int x1 = v[i].first.first;
    int y1 = v[i].first.second;
    int x2 = v[i].second.first;
    int y2 = v[i].second.second;
    if (i == v.size() - 1) {
      slowx[i] = x1;
      shighx[i] = x2;
      slowy[i] = y1;
      shighy[i] = y2;
    } else {
      slowx[i] = max(slowx[i + 1], x1);
      shighx[i] = min(shighx[i + 1], x2);
      slowy[i] = max(slowy[i + 1], y1);
      shighy[i] = min(shighy[i + 1], y2);
    }
  }
  if (slowx[2] <= shighx[2] && slowy[2] <= shighy[2]) {
    printf("%d %d", slowx[2], slowy[2]);
    return 0;
  }
  if (plowx[n - 1] <= phighx[n - 1] && plowy[n - 1] <= phighy[n - 1]) {
    printf("%d %d", plowx[n - 1], plowy[n - 1]);
    return 0;
  }
  for (int i = 2; i <= n - 1; i++) {
    int minx = plowx[i - 1], maxx = phighx[i - 1], miny = plowy[i - 1],
        maxy = phighy[i - 1];
    minx = max(minx, slowx[i + 1]);
    maxx = min(maxx, shighx[i + 1]);
    miny = max(miny, slowy[i + 1]);
    maxy = min(maxy, shighy[i + 1]);
    if (minx <= maxx && miny <= maxy) {
      printf("%d %d", minx, miny);
      return 0;
    }
  }
}
