#include <bits/stdc++.h>
using namespace std;
const long long int inf = 0x3f3f3f3f3f3f3f3fll;
const int N = 3000000, mod = 1000000007;
pair<pair<int, int>, pair<int, int>> overlap(
    pair<pair<int, int>, pair<int, int>> a,
    pair<pair<int, int>, pair<int, int>> b) {
  int x1, x2, y1, y2;
  if (a.first.first > b.first.first) swap(a, b);
  x1 = max(a.first.first, b.first.first);
  x2 = min(a.first.second, b.first.second);
  if (a.second.first > b.second.first) swap(a, b);
  y1 = max(a.second.first, b.second.first);
  y2 = min(a.second.second, b.second.second);
  return {{x1, x2}, {y1, y2}};
}
int main() {
  ios::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.tie(0);
  int n;
  cin >> n;
  vector<pair<pair<int, int>, pair<int, int>>> rect(n + 2), pre(n + 2),
      suf(n + 2);
  pair<pair<int, int>, pair<int, int>> prev = {{-mod, mod}, {-mod, mod}};
  pre[n + 1] = pre[0] = suf[0] = suf[n + 1] = prev;
  pair<pair<int, int>, pair<int, int>> cur;
  for (int i = 1; i <= n; i++) {
    cin >> rect[i].first.first >> rect[i].second.first >>
        rect[i].first.second >> rect[i].second.second;
  }
  for (int i = 1; i <= n; i++) {
    cur = rect[i];
    pre[i] = overlap(pre[i - 1], cur);
  }
  for (int i = n; i >= 1; i--) {
    cur = rect[i];
    suf[i] = overlap(suf[i + 1], cur);
  }
  for (int i = 1; i <= n; i++) {
    cur = overlap(pre[i - 1], suf[i + 1]);
    if (cur.first.second >= cur.first.first &&
        cur.second.second >= cur.second.first) {
      cout << cur.first.first << " " << cur.second.first << endl;
      return 0;
    }
  }
  return 0;
}
