#include <bits/stdc++.h>
using namespace std;
int n;
pair<pair<long long, long long>, pair<long long, long long> > recs[132674],
    pref[132674], suff[132674];
pair<pair<long long, long long>, pair<long long, long long> > intersect(
    pair<pair<long long, long long>, pair<long long, long long> > a,
    pair<pair<long long, long long>, pair<long long, long long> > b) {
  long long x1 = max(a.first.first, b.first.first);
  long long x2 = min(a.second.first, b.second.first);
  long long y1 = max(a.first.second, b.first.second);
  long long y2 = min(a.second.second, b.second.second);
  return make_pair(make_pair(x1, y1), make_pair(x2, y2));
}
bool valid(pair<pair<long long, long long>, pair<long long, long long> > a) {
  return a.first.first <= a.second.first && a.first.second <= a.second.second;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < (n); i++) {
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    recs[i] = make_pair(make_pair(x1, y1), make_pair(x2, y2));
  }
  pref[0] = recs[0];
  suff[n - 1] = recs[n - 1];
  for (int i = (1); i < (n); i++) pref[i] = intersect(pref[i - 1], recs[i]);
  for (int i = (n - 1) - 1; i >= 0; i--)
    suff[i] = intersect(suff[i + 1], recs[i]);
  for (int i = 0; i < (n); i++) {
    if (i == 0) {
      if (valid(suff[i + 1])) {
        cout << suff[i + 1].first.first << " " << suff[i + 1].first.second
             << endl;
        return 0;
      }
    } else if (i == n - 1) {
      if (valid(pref[i - 1])) {
        cout << pref[i - 1].first.first << " " << pref[i - 1].first.second
             << endl;
        return 0;
      }
    } else {
      if (valid(suff[i + 1]) && valid(pref[i - 1])) {
        pair<pair<long long, long long>, pair<long long, long long> >
            intersection = intersect(suff[i + 1], pref[i - 1]);
        if (valid(intersection)) {
          cout << intersection.first.first << " " << intersection.first.second
               << endl;
          return 0;
        }
      }
    }
  }
}
