#include <bits/stdc++.h>
using namespace std;
long long px1[133000], px2[133000], py1[133000], py2[133000], sx1[133000],
    sx2[133000], sy1[133000], sy2[133000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long a[n + 1], b[n + 1], c[n + 1], d[n + 1];
  for (unsigned long long i = 1; i < n + 1; i++)
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  px1[0] = -9999999999, px2[0] = 9999999999, py1[0] = -9999999999,
  py2[0] = 9999999999;
  for (unsigned long long i = 1; i < n + 1; i++) {
    px1[i] = max(a[i], px1[i - 1]);
    px2[i] = min(c[i], px2[i - 1]);
    py1[i] = max(b[i], py1[i - 1]);
    py2[i] = min(d[i], py2[i - 1]);
  }
  sx1[n + 1] = -9999999999, sx2[n + 1] = 9999999999, sy1[n + 1] = -9999999999,
          sy2[n + 1] = 9999999999;
  for (unsigned long long i = n + 1 - 1; i >= 1; i--) {
    sx1[i] = max(a[i], sx1[i + 1]);
    sx2[i] = min(c[i], sx2[i + 1]);
    sy1[i] = max(b[i], sy1[i + 1]);
    sy2[i] = min(d[i], sy2[i + 1]);
  }
  long long ax1, ax2, ay1, ay2;
  for (unsigned long long i = 1; i < n + 1; i++) {
    ax1 = max(px1[i - 1], sx1[i + 1]);
    ax2 = min(px2[i - 1], sx2[i + 1]);
    ay1 = max(py1[i - 1], sy1[i + 1]);
    ay2 = min(py2[i - 1], sy2[i + 1]);
    if (ax1 <= ax2 && ay1 <= ay2) {
      cout << ax1 << " " << ay1 << endl;
      return 0;
    }
  }
  return 0;
}
