#include <bits/stdc++.h>
using namespace std;
const int MAXN = 132674 + 123;
struct rect {
  int lx, ly, hx, hy;
  friend istream& operator>>(istream& in, rect& r) {
    in >> r.lx >> r.ly >> r.hx >> r.hy;
    return in;
  }
  friend ostream& operator<(ostream& out, rect& r) {
    out << r.lx << ' ' << r.ly;
    return out;
  }
  friend rect operator&(rect a, rect b) {
    return {max(a.lx, b.lx), max(b.ly, a.ly), min(a.hx, b.hx), min(a.hy, b.hy)};
  }
  rect(initializer_list<int> ls) {
    lx = *ls.begin();
    ly = *(ls.begin() + 1);
    hx = *(ls.begin() + 2);
    hy = *(ls.begin() + 3);
  }
  bool voj() { return ((lx <= hx) && (ly <= hy)); }
  rect(){};
};
int n;
rect a[MAXN], ps[MAXN], rps[MAXN];
void ok(rect x) {
  if (x.voj()) {
    cout < x;
    exit(0);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  ps[1] = a[0];
  for (int i = 2; i <= n; i++) ps[i] = ps[i - 1] & a[i - 1];
  rps[n - 1] = a[n - 1];
  for (int i = n - 2; ~i; i--) rps[i] = rps[i + 1] & a[i];
  ok(ps[n - 1]);
  ok(rps[1]);
  for (int i = 1; i < n - 1; i++) ok(ps[i] & rps[i + 1]);
  return 0;
}
