#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
pair<pair<long long, long long>, pair<long long, long long> > rec[200000],
    pref[200000], pref2[200000];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, i, a, b, c, d, e, f, g, h, k1, k2, k3, k4, x, y;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    rec[i] = make_pair(make_pair(a, b), make_pair(c, d));
  }
  pref[0] = rec[0];
  pref2[n - 1] = rec[n - 1];
  for (i = 1; i < n; i++) {
    a = pref[i - 1].first.first;
    b = pref[i - 1].first.second;
    c = pref[i - 1].second.first;
    d = pref[i - 1].second.second;
    e = rec[i].first.first;
    f = rec[i].first.second;
    g = rec[i].second.first;
    h = rec[i].second.second;
    pref[i] = make_pair(make_pair(max(a, e), max(b, f)),
                        make_pair(min(c, g), min(d, h)));
  }
  for (i = n - 2; i >= 0; i--) {
    a = pref2[i + 1].first.first;
    b = pref2[i + 1].first.second;
    c = pref2[i + 1].second.first;
    d = pref2[i + 1].second.second;
    e = rec[i].first.first;
    f = rec[i].first.second;
    g = rec[i].second.first;
    h = rec[i].second.second;
    pref2[i] = make_pair(make_pair(max(a, e), max(b, f)),
                         make_pair(min(c, g), min(d, h)));
  }
  for (i = 0; i < n; i++) {
    if (i == 0) {
      k1 = pref2[i + 1].first.first;
      k2 = pref2[i + 1].first.second;
      k3 = pref2[i + 1].second.first;
      k4 = pref2[i + 1].second.second;
      if ((k1 <= k3) && (k2 <= k4)) {
        x = k1;
        y = k2;
        break;
      }
    } else if (i == n - 1) {
      k1 = pref[i - 1].first.first;
      k2 = pref[i - 1].first.second;
      k3 = pref[i - 1].second.first;
      k4 = pref[i - 1].second.second;
      if ((k1 <= k3) && (k2 <= k4)) {
        x = k1;
        y = k2;
        break;
      }
    } else {
      a = pref2[i + 1].first.first;
      b = pref2[i + 1].first.second;
      c = pref2[i + 1].second.first;
      d = pref2[i + 1].second.second;
      e = pref[i - 1].first.first;
      f = pref[i - 1].first.second;
      g = pref[i - 1].second.first;
      h = pref[i - 1].second.second;
      k1 = max(a, e);
      k2 = max(b, f);
      k3 = min(c, g);
      k4 = min(d, h);
      if ((k1 <= k3) && (k2 <= k4)) {
        x = k1;
        y = k2;
        break;
      }
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
