#include <bits/stdc++.h>
using namespace std;
struct rect {
  long long bx, by, tx, ty;
  rect() {
    by = bx = -1e18;
    tx = ty = 1e18;
  }
};
rect mix(rect A, rect B) {
  A.bx = max(A.bx, B.bx);
  A.by = max(A.by, B.by);
  A.tx = min(A.tx, B.tx);
  A.ty = min(A.ty, B.ty);
  if (A.bx <= A.tx && A.by <= A.ty) return A;
  rect temp;
  swap(temp.by, temp.ty);
  swap(temp.bx, temp.tx);
  return temp;
}
void solve() {
  long long n;
  cin >> n;
  rect arr[n], pre[n], suff[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i].bx >> arr[i].by >> arr[i].tx >> arr[i].ty;
  }
  rect temp;
  for (long long i = 0; i < n; i++) {
    pre[i] = arr[i];
    if (i) pre[i] = mix(pre[i], pre[i - 1]);
  }
  for (long long i = n - 1; i >= 0; i--) {
    suff[i] = arr[i];
    if (i != (n - 1)) suff[i] = mix(suff[i], suff[i + 1]);
  }
  for (long long i = 0; i < n; i++) {
    rect prev, nxt;
    if (i != 0) prev = pre[i - 1];
    if (i != (n - 1)) nxt = suff[i + 1];
    prev = mix(prev, nxt);
    if (prev.bx <= prev.tx && prev.by <= prev.ty) {
      cout << prev.bx << " " << prev.by << endl;
      return;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
