#include <bits/stdc++.h>
using namespace std;
const int MX = 200 * 1000 + 7;
const int INF = 1000 * 1000 * 1000 + 7;
struct rect {
  int x1, y1, x2, y2;
};
rect inter(rect a, rect b) {
  rect res;
  res.x1 = max(a.x1, b.x1);
  res.y1 = max(a.y1, b.y1);
  res.x2 = min(a.x2, b.x2);
  res.y2 = min(a.y2, b.y2);
  return res;
}
rect r[MX], pref[MX], suff[MX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> r[i].x1 >> r[i].y1 >> r[i].x2 >> r[i].y2;
  }
  r[0].x1 = -INF;
  r[0].x2 = INF;
  r[0].y1 = -INF;
  r[0].y2 = INF;
  r[n + 1] = r[0];
  pref[0] = r[0];
  for (int i = 1; i <= n + 1; i++) {
    pref[i] = inter(pref[i - 1], r[i]);
  }
  suff[n + 1] = r[n + 1];
  for (int i = n; i >= 0; i--) {
    suff[i] = inter(suff[i + 1], r[i]);
  }
  for (int i = 1; i <= n; i++) {
    rect cur = inter(pref[i - 1], suff[i + 1]);
    if (cur.x1 <= cur.x2 && cur.y1 <= cur.y2) {
      cout << cur.x1 << " " << cur.y1 << "\n";
      return 0;
    }
  }
  assert(false);
}
