#include <bits/stdc++.h>
using namespace std;
const int maxn = 200200;
const int INF = 1000 * 1000 * 1000 + 100;
int xl[maxn], xr[maxn], yl[maxn], yr[maxn];
int minx = INF;
int maxx = -INF;
int miny = INF;
int maxy = -INF;
int minx2 = INF;
int maxx2 = -INF;
int miny2 = INF;
int maxy2 = -INF;
void relax_min(int &minx, int &minx2, int x) {
  if (x < minx) {
    minx2 = minx;
    minx = x;
  } else if (x < minx2) {
    minx2 = x;
  }
}
void relax_max(int &maxx, int &maxx2, int x) {
  if (x > maxx) {
    maxx2 = maxx;
    maxx = x;
  } else if (x > maxx2) {
    maxx2 = x;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> xl[i] >> yl[i] >> xr[i] >> yr[i];
    relax_min(minx, minx2, xr[i]);
    relax_max(maxx, maxx2, xl[i]);
    relax_min(miny, miny2, yr[i]);
    relax_max(maxy, maxy2, yl[i]);
  }
  for (int i = 0; i < n; ++i) {
    int lx = maxx;
    int rx = minx;
    int ly = maxy;
    int ry = miny;
    if (lx == xl[i]) lx = maxx2;
    if (rx == xr[i]) rx = minx2;
    if (ly == yl[i]) ly = maxy2;
    if (ry == yr[i]) ry = miny2;
    if (lx <= rx && ly <= ry) {
      cout << lx << ' ' << ly << endl;
      return 0;
    }
  }
  return 0;
}
