#include <bits/stdc++.h>
using namespace std;
const int maxn = 140000;
int xl[maxn];
int xr[maxn], yd[maxn], yu[maxn];
int tmpx1[maxn], tmpx2[maxn], tmpy1[maxn], tmpy2[maxn];
bool help(int x, int y, int x1, int x2, int y1, int y2) {
  return (x >= x1 && x <= x2) && (y >= y1 && y <= y2);
}
int main() {
  int x1, y1, x2, y3;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &xl[i], &yd[i], &xr[i], &yu[i]);
    tmpx1[i] = xl[i];
    tmpx2[i] = xr[i];
    tmpy1[i] = yd[i];
    tmpy2[i] = yu[i];
  }
  sort(xl + 1, xl + 1 + n);
  sort(xr + 1, xr + 1 + n);
  int tl = xl[n], tr = xr[1];
  sort(yd + 1, yd + 1 + n);
  sort(yu + 1, yu + 1 + n);
  int td = yd[n], tu = yu[1];
  for (int i = 1; i <= n; i++) {
    int tl = xl[n], tr = xr[1];
    int td = yd[n], tu = yu[1];
    if (tmpx1[i] == xl[n]) tl = xl[n - 1];
    if (tmpx2[i] == xr[1]) tr = xr[2];
    if (tmpy1[i] == yd[n]) td = yd[n - 1];
    if (tmpy2[i] == yu[1]) tu = yu[2];
    if (tr >= tl && tu >= td) {
      printf("%d %d\n", tl, td);
      return 0;
    }
  }
  return 0;
}
