#include <bits/stdc++.h>
using namespace std;
const int OO = 2e9 + 9;
const int MAX = 1e6 + 6;
int n;
pair<pair<int, int>, pair<int, int> > a[MAX], pref[MAX], suff[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> a[1].first.first >> a[1].first.second >> a[1].second.first >>
      a[1].second.second;
  pref[1] = a[1];
  for (int i = 2; i <= n; ++i) {
    cin >> a[i].first.first >> a[i].first.second >> a[i].second.first >>
        a[i].second.second;
    pref[i].first.first = max(pref[i - 1].first.first, a[i].first.first);
    pref[i].second.first = min(pref[i - 1].second.first, a[i].second.first);
    pref[i].first.second = max(pref[i - 1].first.second, a[i].first.second);
    pref[i].second.second = min(pref[i - 1].second.second, a[i].second.second);
  }
  suff[n] = a[n];
  for (int i = n - 1; i >= 1; --i) {
    suff[i].first.first = max(suff[i + 1].first.first, a[i].first.first);
    suff[i].second.first = min(suff[i + 1].second.first, a[i].second.first);
    suff[i].first.second = max(suff[i + 1].first.second, a[i].first.second);
    suff[i].second.second = min(suff[i + 1].second.second, a[i].second.second);
  }
  pref[0] = suff[n + 1] = {{-OO, -OO}, {OO, OO}};
  for (int i = 1; i <= n; ++i) {
    pair<pair<int, int>, pair<int, int> > intersect;
    intersect.first.first =
        max(pref[i - 1].first.first, suff[i + 1].first.first);
    intersect.second.first =
        min(pref[i - 1].second.first, suff[i + 1].second.first);
    intersect.first.second =
        max(pref[i - 1].first.second, suff[i + 1].first.second);
    intersect.second.second =
        min(pref[i - 1].second.second, suff[i + 1].second.second);
    if (intersect.first.first <= intersect.second.first &&
        intersect.first.second <= intersect.second.second) {
      cout << intersect.first.first << " " << intersect.first.second;
      return 0;
    }
  }
  return 0;
}
