#include <bits/stdc++.h>
using namespace std;
struct rect {
  int xl, yl, xh, yh;
};
rect arr[200000], pre[200000], suf[200000];
rect inter(rect a, rect b) {
  return {max(a.xl, b.xl), max(a.yl, b.yl), min(a.xh, b.xh), min(a.yh, b.yh)};
}
void print(rect a) { printf("%d %d", a.xl, a.yl); }
bool ok(rect a) { return (a.xl <= a.xh && a.yl <= a.yh); }
int main() {
  int t, i, j, l, xl, xh, yl, yh;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> arr[i].xl >> arr[i].yl >> arr[i].xh >> arr[i].yh;
  }
  pre[0] = arr[0];
  suf[t - 1] = arr[t - 1];
  for (i = 1; i < t; i++) pre[i] = inter(pre[i - 1], arr[i]);
  for (i = t - 2; i >= 0; i--) suf[i] = inter(suf[i + 1], arr[i]);
  if (ok(pre[t - 2]))
    print(pre[t - 2]);
  else if (ok(suf[1]))
    print(suf[1]);
  else {
    for (i = 1; i < t - 1; i++) {
      rect T = inter(pre[i - 1], suf[i + 1]);
      if (ok(T)) {
        print(T);
        break;
      }
    }
  }
  return 0;
}
