#include <bits/stdc++.h>
using namespace std;
const int Max = 2000 * 1000 + 200;
vector<pair<int, int> > s[2];
struct xz1 {
  int mrx, mry, urx, ury;
  int mark = 0;
};
struct bz1 {
  int mrx, mry, urx, ury;
  int mark = 0;
};
xz1 xz[Max];
bz1 bz[Max];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    s[0].push_back({x, y});
    cin >> x >> y;
    s[1].push_back({x, y});
  }
  int mrx, mry, urx, ury;
  mrx = -1e9 - 10;
  mry = -1e9 - 10;
  urx = 1e9 + 10;
  ury = 1e9 + 10;
  for (int j = 0; j < n; j++) {
    xz[j].mrx = max(mrx, s[0][j].first);
    xz[j].mry = max(mry, s[0][j].second);
    xz[j].urx = min(urx, s[1][j].first);
    xz[j].ury = min(ury, s[1][j].second);
    mrx = xz[j].mrx;
    mry = xz[j].mry;
    urx = xz[j].urx;
    ury = xz[j].ury;
    if (mrx > urx || mry > ury) {
      xz[j].mark = 1;
    }
  }
  mrx = -1e9 - 10;
  mry = -1e9 - 10;
  urx = 1e9 + 10;
  ury = 1e9 + 10;
  for (int j = n - 1; j >= 0; j--) {
    bz[j].mrx = max(mrx, s[0][j].first);
    bz[j].mry = max(mry, s[0][j].second);
    bz[j].urx = min(urx, s[1][j].first);
    bz[j].ury = min(ury, s[1][j].second);
    mrx = bz[j].mrx;
    mry = bz[j].mry;
    urx = bz[j].urx;
    ury = bz[j].ury;
    if (mrx > urx || mry > ury) {
      bz[j].mark = 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (bz[1].mark == 0) {
        cout << bz[1].mrx << " " << bz[1].mry;
        return 0;
      }
    } else if (i == (n - 1)) {
      if (xz[n - 2].mark == 0)
        return cout << xz[n - 2].mrx << " " << xz[n - 2].mry, 0;
    } else {
      if (xz[i - 1].mark == 0 && bz[i + 1].mark == 0) {
        int pxa, pya, bxa, bya;
        pxa = max(xz[i - 1].mrx, bz[i + 1].mrx);
        pya = max(xz[i - 1].mry, bz[i + 1].mry);
        bxa = min(xz[i - 1].urx, bz[i + 1].urx);
        bya = min(xz[i - 1].ury, bz[i + 1].ury);
        if (pxa > bxa || pya > bya) continue;
        return cout << pxa << " " << pya, 0;
      }
    }
  }
  return 0;
}
