#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  cin >> n;
  int x1, y1, x2, y2;
  int arr[n][4];
  for (i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2] >> arr[i][3];
  }
  int suc[n][4];
  suc[0][0] = arr[0][0];
  suc[0][1] = arr[0][1];
  suc[0][2] = arr[0][2];
  suc[0][3] = arr[0][3];
  for (i = 1; i < n; i++) {
    if (suc[i - 1][0] == INT_MIN) {
      suc[i][0] = suc[i][1] = suc[i][2] = suc[i][3] = INT_MIN;
      continue;
    }
    if (arr[i][2] < suc[i - 1][0] || arr[i][0] > suc[i - 1][2] ||
        arr[i][1] > suc[i - 1][3] || arr[i][3] < suc[i - 1][1]) {
      suc[i][0] = suc[i][1] = suc[i][2] = suc[i][3] = INT_MIN;
      continue;
    }
    suc[i][0] = max(suc[i - 1][0], arr[i][0]);
    suc[i][2] = min(suc[i - 1][2], arr[i][2]);
    suc[i][1] = max(suc[i - 1][1], arr[i][1]);
    suc[i][3] = min(suc[i - 1][3], arr[i][3]);
  }
  int pre[n][4];
  pre[n - 1][0] = arr[n - 1][0];
  pre[n - 1][1] = arr[n - 1][1];
  pre[n - 1][2] = arr[n - 1][2];
  pre[n - 1][3] = arr[n - 1][3];
  for (i = n - 2; i >= 0; i--) {
    if (pre[i + 1][0] == INT_MIN) {
      pre[i][0] = pre[i][1] = pre[i][2] = pre[i][3] = INT_MIN;
      continue;
    }
    if (arr[i][2] < pre[i + 1][0] || arr[i][0] > pre[i + 1][2] ||
        arr[i][1] > pre[i + 1][3] || arr[i][3] < pre[i + 1][1]) {
      pre[i][0] = pre[i][1] = pre[i][2] = pre[i][3] = INT_MIN;
      continue;
    }
    pre[i][0] = max(pre[i + 1][0], arr[i][0]);
    pre[i][2] = min(pre[i + 1][2], arr[i][2]);
    pre[i][1] = max(pre[i + 1][1], arr[i][1]);
    pre[i][3] = min(pre[i + 1][3], arr[i][3]);
  }
  if (suc[n - 2][0] != INT_MIN) {
    cout << suc[n - 2][0] << " " << suc[n - 2][1] << endl;
    return 0;
  }
  if (pre[1][0] != INT_MIN) {
    cout << pre[1][0] << " " << pre[1][1] << endl;
    return 0;
  }
  for (i = 0; i < n - 2; i++) {
    if (suc[i][2] < pre[i + 2][0] || suc[i][0] > pre[i + 2][2] ||
        suc[i][1] > pre[i + 2][3] || suc[i][3] < pre[i + 2][1]) {
      continue;
    }
    cout << max(pre[i + 2][0], suc[i][0]) << " "
         << max(pre[i + 2][1], suc[i][1]) << endl;
    return 0;
  }
}
