#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int INF = 1e9 + 5;
struct rectangle {
  long long x1, y1, x2, y2;
  rectangle(long long _x1 = -INF, long long _y1 = -INF, long long _x2 = -INF,
            long long _y2 = -INF)
      : x1(_x1), y1(_y1), x2(_x2), y2(_y2) {}
  bool valid() const { return x1 <= x2 && y1 <= y2; }
  rectangle intersect(const rectangle &other) const {
    return rectangle(max(x1, other.x1), max(y1, other.y1), min(x2, other.x2),
                     min(y2, other.y2));
  }
};
void output_rectange(rectangle x) { cout << x.x1 << " " << x.y1 << '\n'; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<rectangle> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
  }
  if (n == 2) {
    output_rectange(a[0]);
    return 0;
  }
  sort(a.begin(), a.end(),
       [](rectangle a, rectangle b) { return a.x1 < b.x1; });
  vector<rectangle> pref(n), suf(n);
  pref[0] = a[0];
  for (int i = 1; i < n; i++) {
    pref[i] = a[i].intersect(pref[i - 1]);
  }
  suf[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    suf[i] = a[i].intersect(suf[i + 1]);
  }
  for (int i = 0; i < n; i++) {
    rectangle x;
    if (i == 0) {
      x = suf[i + 1];
    } else if (i == n - 1) {
      x = pref[n - 2];
    } else
      x = pref[i - 1].intersect(suf[i + 1]);
    if (x.valid()) {
      output_rectange(x);
      return 0;
    }
  }
  return 0;
}
