#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > intersect(vector<pair<int, int> > prefRect,
                                  vector<pair<int, int> > suffRect) {
  prefRect[0].first = max(prefRect[0].first, suffRect[0].first);
  prefRect[0].second = max(prefRect[0].second, suffRect[0].second);
  prefRect[1].first = min(prefRect[1].first, suffRect[1].first);
  prefRect[1].second = min(prefRect[1].second, suffRect[1].second);
  if (prefRect[0].first > prefRect[1].first ||
      prefRect[0].second > prefRect[1].second) {
    return vector<pair<int, int> >(0);
  } else
    return prefRect;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<vector<pair<int, int> > > rects(n, vector<pair<int, int> >(2));
  for (int i = 0; i < n; i++) {
    cin >> rects[i][0].first >> rects[i][0].second;
    cin >> rects[i][1].first >> rects[i][1].second;
  }
  vector<vector<pair<int, int> > > suffs(n, vector<pair<int, int> >(0));
  suffs[0] = rects[n - 1];
  for (int i = 1; i < n; i++) {
    if (suffs[i - 1].size() == 0) continue;
    suffs[i] = intersect(suffs[i - 1], rects[n - i - 1]);
  }
  reverse(suffs.begin(), suffs.end());
  vector<vector<pair<int, int> > > prefs(n, vector<pair<int, int> >(0));
  prefs[0] = rects[0];
  for (int i = 1; i < n; i++) {
    if (prefs[i - 1].size() == 0) continue;
    prefs[i] = intersect(prefs[i - 1], rects[i]);
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (suffs[1].size() > 0) {
        cout << suffs[1][0].first << " " << suffs[1][0].second << endl;
        return 0;
      }
    } else if (i == n - 1) {
      if (prefs[n - 2].size() > 0) {
        cout << prefs[n - 2][0].first << " " << prefs[n - 2][0].second << endl;
        return 0;
      }
    } else {
      if (prefs[i - 1].size() == 0 || suffs[i + 1].size() == 0) continue;
      vector<pair<int, int> > answ = intersect(prefs[i - 1], suffs[i + 1]);
      if (answ.size() == 0) continue;
      cout << answ[0].first << " " << answ[0].second;
      return 0;
    }
  }
  return 0;
}
