#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = int(1e9) + 1;
struct rect {
  int x1, y1, x2, y2;
};
rect intersec(rect a, rect b) {
  return {max(a.x1, b.x1), max(a.y1, b.y1), min(a.x2, b.x2), min(a.y2, b.y2)};
}
int main() {
  int n;
  cin >> n;
  vector<rect> pre(n + 2), suf(n + 2);
  vector<rect> v(n + 2);
  pre[0] = {-INF, -INF, INF, INF};
  pre[n + 1] = {-INF, -INF, INF, INF};
  pre[0] = {-INF, -INF, INF, INF};
  suf[n + 1] = {-INF, -INF, INF, INF};
  for (int i = 1; i <= n; i++) {
    cin >> v[i].x1 >> v[i].y1 >> v[i].x2 >> v[i].y2;
    pre[i] = intersec(pre[i - 1], v[i]);
  }
  for (int i = n; i >= 1; i--) {
    suf[i] = intersec(v[i], suf[i + 1]);
  }
  for (int i = 1; i <= n; i++) {
    rect without = intersec(pre[i - 1], suf[i + 1]);
    if (without.x1 <= without.x2 && without.y1 <= without.y2) {
      cout << without.x1 << " " << without.y1 << endl;
      return 0;
    }
  }
  return 0;
}
