#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 150005;
const int INF = 0x3f3f3f3f;
int i, n, x[N], y[N], xx[N], yy[N], px[N], py[N], pxx[N], pyy[N], sx[N], sy[N],
    sxx[N], syy[N];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) {
    scanf("%d %d %d %d", x + i, y + i, xx + i, yy + i);
    px[i] = sx[i] = x[i];
    pxx[i] = sxx[i] = xx[i];
    py[i] = sy[i] = y[i];
    syy[i] = pyy[i] = yy[i];
  }
  px[0] = py[0] = sx[n + 1] = sy[n + 1] = -INF;
  pxx[0] = pyy[0] = sxx[n + 1] = syy[n + 1] = INF;
  for (i = 1; i <= n; ++i) {
    px[i] = max(px[i], px[i - 1]);
    py[i] = max(py[i], py[i - 1]);
    pxx[i] = min(pxx[i], pxx[i - 1]);
    pyy[i] = min(pyy[i], pyy[i - 1]);
  }
  for (i = n; i > 0; --i) {
    sx[i] = max(sx[i], sx[i + 1]);
    sy[i] = max(sy[i], sy[i + 1]);
    sxx[i] = min(sxx[i], sxx[i + 1]);
    syy[i] = min(syy[i], syy[i + 1]);
  }
  for (i = 1; i <= n; ++i) {
    int cx = max(px[i - 1], sx[i + 1]);
    int cy = max(py[i - 1], sy[i + 1]);
    int cxx = min(pxx[i - 1], sxx[i + 1]);
    int cyy = min(pyy[i - 1], syy[i + 1]);
    if (cx > cxx || cy > cyy) continue;
    printf("%d %d\n", cx, cy);
    break;
  }
  return 0;
}
