#include <bits/stdc++.h>
using namespace std;
struct Point {
  long x, y;
};
bool doOverlap(Point l1, Point r1, Point l2, Point r2) {
  if (l1.x > r2.x || l2.x > r1.x) return false;
  if (l1.y > r2.y || l2.y > r1.y) return false;
  return true;
}
pair<Point, Point> intersection(Point l1, Point r1, Point l2, Point r2) {
  pair<Point, Point> res;
  res.first.x = max(l1.x, l2.x);
  res.first.y = max(l1.y, l2.y);
  res.second.x = min(r1.x, r2.x);
  res.second.y = min(r1.y, r2.y);
  return res;
}
int main() {
  int n, i;
  cin >> n;
  vector<pair<Point, Point> > p(n), pre(n), suf(n);
  vector<bool> notPosp(n, 0), notPoss(n, 0);
  for (i = 0; i < n; i++) {
    cin >> p[i].first.x >> p[i].first.y >> p[i].second.x >> p[i].second.y;
  }
  pre[0] = p[0];
  for (i = 1; i < n; i++) {
    if (notPosp[i - 1]) {
      notPosp[i] = 1;
      continue;
    }
    if (doOverlap(pre[i - 1].first, pre[i - 1].second, p[i].first,
                  p[i].second)) {
      pre[i] = intersection(pre[i - 1].first, pre[i - 1].second, p[i].first,
                            p[i].second);
    } else
      notPosp[i] = 1;
  }
  suf[n - 1] = p[n - 1];
  for (i = n - 2; i >= 0; i--) {
    if (notPoss[i + 1]) {
      notPoss[i] = 1;
      continue;
    }
    if (doOverlap(suf[i + 1].first, suf[i + 1].second, p[i].first,
                  p[i].second)) {
      suf[i] = intersection(suf[i + 1].first, suf[i + 1].second, p[i].first,
                            p[i].second);
    } else
      notPoss[i] = 1;
  }
  pair<Point, Point> res;
  long x, y;
  for (i = 1; i < n - 1; i++) {
    if (notPosp[i - 1] == 0 && notPoss[i + 1] == 0) {
      if (doOverlap(pre[i - 1].first, pre[i - 1].second, suf[i + 1].first,
                    suf[i + 1].second)) {
        res = intersection(pre[i - 1].first, pre[i - 1].second,
                           suf[i + 1].first, suf[i + 1].second);
        x = res.first.x;
        y = res.first.y;
        cout << x << " " << y << endl;
        exit(0);
      }
    }
  }
  if (!notPoss[1]) {
    x = suf[1].first.x;
    y = suf[1].first.y;
    cout << x << " " << y << endl;
    exit(0);
  } else if (!notPosp[n - 2]) {
    x = pre[n - 2].first.x;
    y = pre[n - 2].first.y;
    cout << x << " " << y << endl;
  }
}
