#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const long long mod = 1e9 + 7;
const long long nax = 300006;
const long long inf = 2e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct rect {
  long long a, b, c, d;
  void read() { cin >> a >> b >> c >> d; }
  rect inter(const rect &other) const {
    pair<long long, long long> ox;
    ox = make_pair(max(a, other.a), min(c, other.c));
    pair<long long, long long> oy;
    oy = make_pair(max(b, other.b), min(d, other.d));
    if (ox.second < ox.first || oy.second < oy.first) {
      return rect{inf, inf, inf, inf};
    }
    return {ox.first, oy.first, ox.second, oy.second};
  }
  void print() { cout << a << ' ' << b << '\n'; }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<rect> a(n);
  for (rect &x : a) {
    x.read();
  }
  vector<rect> pref(n), suff(n);
  pref[0] = a[0], suff[n - 1] = a[n - 1];
  for (long long i = 1; i < n; ++i) {
    pref[i] = pref[i - 1].inter(a[i]);
  }
  for (long long i = n - 2; i >= 0; i--) {
    suff[i] = suff[i + 1].inter(a[i]);
  }
  if (suff[1].a != inf) {
    suff[1].print();
    return 0;
  }
  if (pref[n - 2].a != inf) {
    pref[n - 2].print();
    return 0;
  }
  for (long long i = 1; i < n - 1; ++i) {
    rect ans = pref[i - 1].inter(suff[i + 1]);
    if (ans.a != inf) {
      ans.print();
      return 0;
    }
  }
  return 0;
}
