#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long alpha;
  alpha = pow(10, 10);
  long long arr[n][4];
  long long prefix[n][4], suffix[n][4], p, k;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 4; j++) {
      cin >> arr[i][j];
      prefix[i][j] = -alpha;
      suffix[i][j] = -alpha;
    }
  }
  if (n == 1) {
    cout << arr[0][0] << " " << arr[0][1];
    return 0;
  }
  for (long long j = 0; j < 4; j++) {
    prefix[1][j] = arr[0][j];
    suffix[n - 2][j] = arr[n - 1][j];
  }
  for (long long i = 2; i < n; i++) {
    long long a, b, c, d;
    a = max(prefix[i - 1][0], arr[i - 1][0]);
    b = max(prefix[i - 1][1], arr[i - 1][1]);
    c = min(prefix[i - 1][2], arr[i - 1][2]);
    d = min(prefix[i - 1][3], arr[i - 1][3]);
    if (c >= a && d >= b) {
      prefix[i][0] = a;
      prefix[i][1] = b;
      prefix[i][2] = c;
      prefix[i][3] = d;
    } else {
      break;
    }
  }
  for (long long i = n - 3; i >= 0; i--) {
    long long a, b, c, d;
    a = max(suffix[i + 1][0], arr[i + 1][0]);
    b = max(suffix[i + 1][1], arr[i + 1][1]);
    c = min(suffix[i + 1][2], arr[i + 1][2]);
    d = min(suffix[i + 1][3], arr[i + 1][3]);
    if (c >= a && d >= b) {
      suffix[i][0] = a;
      suffix[i][1] = b;
      suffix[i][2] = c;
      suffix[i][3] = d;
    } else {
      break;
    }
  }
  for (long long i = 0; i < n; i++) {
    long long a, b, c, d;
    a = max(suffix[i][0], prefix[i][0]);
    b = max(suffix[i][1], prefix[i][1]);
    c = min(suffix[i][2], prefix[i][2]);
    d = min(suffix[i][3], prefix[i][3]);
    if (i == 0) {
      if (suffix[0][0] != -alpha) {
        cout << suffix[0][0] << " " << suffix[0][1];
        return 0;
      }
    } else if (i == n - 1) {
      if (prefix[n - 1][0] != -alpha) {
        cout << prefix[n - 1][0] << " " << prefix[n - 1][1];
        return 0;
      }
    } else if (c >= a && d >= b) {
      cout << a << " " << b;
      return 0;
    }
  }
  return 0;
}
