#include <bits/stdc++.h>
using namespace std;
void splitx(string s, char c, vector<string> &v) {
  long long i = 0, j;
  while (i < (long long)(s).size()) {
    j = i;
    string temp;
    while (j < (long long)(s).size() && s[j] != c) {
      temp += s[j];
      j++;
    }
    v.push_back(temp);
    i = j + 1;
  }
}
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<pair<long long, long long> > px, py, qx, qy;
  long long a, b, c, d;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    px.push_back({a, i});
    py.push_back({b, i});
    qx.push_back({c, i});
    qy.push_back({d, i});
  }
  sort(px.begin(), px.end());
  sort(py.begin(), py.end());
  sort(qx.begin(), qx.end());
  sort(qy.begin(), qy.end());
  long long mpx = (px.back()).first;
  long long mpy = (py.back()).first;
  long long mqx = (qx.front()).first;
  long long mqy = (qy.front()).first;
  bool fl1 = (mpx <= mqx);
  bool fl2 = (mpy <= mqy);
  if (fl1 && fl2) {
    cout << mpx << " " << mpy << '\n';
  } else {
    if (px[n - 2].first <= mqx) {
      long long ii = px[n - 1].second;
      if (py[n - 1].second == ii) {
        mpy = py[n - 2].first;
      }
      if (qy[0].second == ii) {
        mqy = qy[1].first;
      }
      if (mpy <= mqy) {
        cout << px[n - 2].first << " " << mpy << '\n';
        return 0;
      }
    }
    if (mpx <= qx[1].first) {
      long long ii = qx[0].second;
      if (py[n - 1].second == ii) {
        mpy = py[n - 2].first;
      }
      if (qy[0].second == ii) {
        mqy = qy[1].first;
      }
      if (mpy <= mqy) {
        cout << qx[1].first << " " << mpy << '\n';
        return 0;
      }
    }
    if (py[n - 2].first <= mqy) {
      long long ii = py[n - 1].second;
      if (px[n - 1].second == ii) {
        mpx = px[n - 2].first;
      }
      if (qx[0].second == ii) {
        mqx = qx[1].first;
      }
      if (mpx <= mqx) {
        cout << mpx << " " << py[n - 2].first << '\n';
        return 0;
      }
    }
    if (mpy <= qy[1].first) {
      long long ii = qy[0].second;
      if (px[n - 1].second == ii) {
        mpx = px[n - 2].first;
      }
      if (qx[0].second == ii) {
        mqx = qx[1].first;
      }
      if (mpx <= mqx) {
        cout << mpx << " " << qy[1].first << '\n';
        return 0;
      }
    }
  }
  return 0;
}
