#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  long long n, i;
  cin >> n;
  long long ax[n][2];
  long long ay[n][2];
  for (i = 0; i < n; i++) cin >> ax[i][0] >> ay[i][0] >> ax[i][1] >> ay[i][1];
  long long leftx[n][2];
  leftx[0][0] = ax[0][0];
  leftx[0][1] = ax[0][1];
  for (i = 1; i < n; i++) {
    long long l = max(ax[i][0], leftx[i - 1][0]);
    long long r = min(ax[i][1], leftx[i - 1][1]);
    if (r < l) {
      leftx[i][0] = 1000000007;
      leftx[i][1] = 1000000007;
    } else {
      leftx[i][0] = l;
      leftx[i][1] = r;
    }
  }
  long long rightx[n][2];
  rightx[n - 1][0] = ax[n - 1][0];
  rightx[n - 1][1] = ax[n - 1][1];
  for (i = n - 2; i >= 0; i--) {
    long long l = max(ax[i][0], rightx[i + 1][0]);
    long long r = min(ax[i][1], rightx[i + 1][1]);
    if (r < l)
      rightx[i][0] = (rightx[i][1] = 1000000007);
    else {
      rightx[i][0] = l;
      rightx[i][1] = r;
    }
  }
  long long lefty[n][2];
  lefty[0][0] = ay[0][0];
  lefty[0][1] = ay[0][1];
  for (i = 1; i < n; i++) {
    long long l = max(ay[i][0], lefty[i - 1][0]);
    long long r = min(ay[i][1], lefty[i - 1][1]);
    if (r < l) {
      lefty[i][0] = 1000000007;
      lefty[i][1] = 1000000007;
    } else {
      lefty[i][0] = l;
      lefty[i][1] = r;
    }
  }
  long long righty[n][2];
  righty[n - 1][0] = ay[n - 1][0];
  righty[n - 1][1] = ay[n - 1][1];
  for (i = n - 2; i >= 0; i--) {
    long long l = max(ay[i][0], righty[i + 1][0]);
    long long r = min(ay[i][1], righty[i + 1][1]);
    if (r < l)
      righty[i][0] = (righty[i][1] = 1000000007);
    else {
      righty[i][0] = l;
      righty[i][1] = r;
    }
  }
  bool done = false;
  for (i = 1; i < n - 1; i++) {
    long long lx = max(leftx[i - 1][0], rightx[i + 1][0]);
    long long rx = min(leftx[i - 1][1], rightx[i + 1][1]);
    long long ly = max(lefty[i - 1][0], righty[i + 1][0]);
    long long ry = min(lefty[i - 1][1], righty[i + 1][1]);
    if (rx >= lx && ry >= ly && lx < 1000000007 && ly < 1000000007) {
      cout << lx << " " << ly;
      done = true;
      break;
    }
  }
  if (done) return 0;
  long long lx = rightx[1][0];
  long long rx = rightx[1][1];
  long long ly = righty[1][0];
  long long ry = righty[1][1];
  if (rx >= lx && ry >= ly && lx < 1000000007 && ly < 1000000007) {
    cout << lx << " " << ly;
    done = true;
    return 0;
  }
  lx = leftx[n - 2][0];
  rx = leftx[n - 2][1];
  ly = lefty[n - 2][0];
  ry = lefty[n - 2][1];
  if (rx >= lx && ry >= ly && lx < 1000000007 && ly < 1000000007) {
    cout << lx << " " << ly;
    done = true;
    return 0;
  }
}
