#include <bits/stdc++.h>
using namespace std;
inline void Boost() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const int INF = 2e9;
struct point {
  int a, b, c, d;
  bool operator!=(const point other) {
    if (other.a == a || other.b == b || other.c == c || other.d == d)
      return false;
    return true;
  }
};
const point oob = {INF, INF, INF, INF};
point Intersect(const point x, const point y) {
  point ret;
  ret.a = max(y.a, x.a);
  ret.c = min(y.c, x.c);
  ret.b = max(y.b, x.b);
  ret.d = min(y.d, x.d);
  if (ret.a > ret.c || ret.b > ret.d) {
    return oob;
  }
  return ret;
}
int main() {
  Boost();
  int n;
  cin >> n;
  vector<point> v(n);
  for (auto &x : v) {
    cin >> x.a >> x.b >> x.c >> x.d;
  }
  vector<point> suf(n), pref(n);
  suf[0] = v[0];
  for (int i = 1; i < n; ++i) {
    suf[i] = Intersect(suf[i - 1], v[i]);
  }
  pref[n - 1] = v[n - 1];
  for (int i = n - 2; i >= 0; --i) {
    pref[i] = Intersect(pref[i + 1], v[i]);
  }
  if (suf[n - 2] != oob) {
    cout << suf[n - 2].a << " " << suf[n - 2].b << "\n";
    exit(0);
  }
  if (pref[1] != oob) {
    cout << pref[1].a << " " << pref[1].b << "\n";
    exit(0);
  }
  for (int i = 1; i < n - 1; ++i) {
    point ans = Intersect(suf[i - 1], pref[i + 1]);
    if (ans != oob) {
      cout << ans.a << " " << ans.b;
      exit(0);
    }
  }
  return 0;
}
