#include <bits/stdc++.h>
using namespace std;
int x[200005], y[200005], x2[200005], y2[200005], prey[200005], prey1[200005];
int prex[200005], prex1[200005], lowx[200005], lowy[200005], lowx1[200005],
    lowy1[200005];
int main() {
  std::ios::sync_with_stdio(false);
  int n, i, a, b, c, d;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i] >> x2[i] >> y2[i];
  }
  prey[0] = y2[0];
  prex[0] = x2[0];
  lowx[0] = x[0];
  lowy[0] = y[0];
  for (i = 1; i < n; i++) {
    prey[i] = min(prey[i - 1], y2[i]);
    prex[i] = min(prex[i - 1], x2[i]);
    lowx[i] = max(lowx[i - 1], x[i]);
    lowy[i] = max(lowy[i - 1], y[i]);
  }
  prey1[n - 1] = y2[n - 1];
  prex1[n - 1] = x2[n - 1];
  lowx1[n - 1] = x[n - 1];
  lowy1[n - 1] = y[n - 1];
  for (i = n - 2; i >= 0; i--) {
    prey1[i] = min(prey1[i + 1], y2[i]);
    prex1[i] = min(prex1[i + 1], x2[i]);
    lowx1[i] = max(lowx1[i + 1], x[i]);
    lowy1[i] = max(lowy1[i + 1], y[i]);
  }
  for (i = 1; i < n - 1; i++) {
    a = min(prey[i - 1], prey1[i + 1]);
    b = min(prex[i - 1], prex1[i + 1]);
    c = max(lowx[i - 1], lowx1[i + 1]);
    d = max(lowy[i - 1], lowy1[i + 1]);
    if (a < d || c > b) {
      continue;
    }
    cout << b << " " << a << endl;
    return 0;
  }
  if (prey[n - 2] >= lowy[n - 2] && prex[n - 2] >= lowx[n - 2]) {
    cout << prex[n - 2] << " " << prey[n - 2] << endl;
    return 0;
  }
  if (prey1[1] >= lowy1[1] && prex1[1] >= lowx1[1]) {
    cout << prex1[1] << " " << prey1[1] << endl;
    return 0;
  }
}
