#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  map<int, pair<int, map<int, int>>> mp;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int left, right, top, bot;
    cin >> left >> bot >> right >> top;
    right++;
    top++;
    if (!mp.count(left)) mp.insert({left, pair<int, map<int, int>>()});
    if (!mp.count(right)) mp.insert({right, pair<int, map<int, int>>()});
    if (!mp[left].second.count(top)) mp[left].second.insert({top, 0});
    if (!mp[left].second.count(bot)) mp[left].second.insert({bot, 0});
    if (!mp[right].second.count(top)) mp[right].second.insert({top, 0});
    if (!mp[right].second.count(bot)) mp[right].second.insert({bot, 0});
    mp[left].first++;
    mp[right].first--;
    mp[left].second[top]--;
    mp[left].second[bot]++;
    mp[right].second[top]++;
    mp[right].second[bot]--;
  }
  map<int, int> now;
  int cnt = 0;
  int answ1, answ2;
  for (auto p : mp) {
    cnt += p.second.first;
    for (auto m : p.second.second) {
      if (!now.count(m.first)) now.insert({m.first, 0});
      now[m.first] += m.second;
    }
    if (cnt >= n - 1) {
      int sum = 0;
      for (auto m : now) {
        sum += m.second;
        if (sum >= n - 1) {
          answ1 = p.first;
          answ2 = m.first;
        }
      }
    }
  }
  cout << answ1 << " " << answ2;
  return 0;
}
