#include <bits/stdc++.h>
#pragma GCC optimize("O3,no-stack-protector,unroll-loops,fast-math")
using namespace std;
struct coor {
  long long x, y, x1, y1;
};
vector<struct coor> v;
struct coor ldp[200005], rdp[200005];
struct coor inter(struct coor l, struct coor r) {
  struct coor res = {INT_MIN, INT_MIN, INT_MIN, INT_MIN};
  if (min(l.x1, r.x1) < max(r.x, l.x) || min(l.y1, r.y1) < max(r.y, l.y))
    return res;
  res.x = max(l.x, r.x);
  res.x1 = min(l.x1, r.x1);
  res.y = max(l.y, r.y);
  res.y1 = min(l.y1, r.y1);
  return res;
}
bool check(struct coor l) { return (l.x != INT_MIN); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a = 0, b = 0, c, d, e, f = 0, l, g, m, n, k, i, j, t, p, q;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    v.push_back({a, b, c, d});
  }
  ldp[0] = v[0];
  for (i = 1; i < n; i++) {
    ldp[i] = inter(ldp[i - 1], v[i]);
  }
  rdp[n - 1] = v[n - 1];
  for (i = n - 2; i >= 0; i--) {
    rdp[i] = inter(rdp[i + 1], v[i]);
  }
  if (check(ldp[n - 2])) {
    cout << ldp[n - 2].x << ' ' << ldp[n - 2].y << '\n';
  } else if (check(rdp[1])) {
    cout << rdp[1].x << ' ' << rdp[1].y << '\n';
  } else {
    for (i = 1; i < n - 1; i++) {
      struct coor fin = inter(ldp[i - 1], rdp[i + 1]);
      if (check(fin)) {
        cout << fin.x << ' ' << fin.y << '\n';
        return 0;
      }
    }
  }
  return 0;
}
