#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  multiset<int> sx, fx, sy, fy;
  int x1[n], y1[n], x2[n], y2[n];
  for (int i = 0; i < n; i++) {
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    fx.insert(x1[i]);
    sx.insert(x2[i]);
    fy.insert(y1[i]);
    sy.insert(y2[i]);
  }
  int sxx, fxx, syy, fyy;
  for (int i = 0; i < n; i++) {
    sx.erase(sx.find(x2[i]));
    fx.erase(fx.find(x1[i]));
    fy.erase(fy.find(y1[i]));
    sy.erase(sy.find(y2[i]));
    sxx = *sx.begin();
    fxx = *fx.rbegin();
    syy = *sy.begin();
    fyy = *fy.rbegin();
    if (sxx >= fxx && syy >= fyy) {
      cout << fxx << " " << fyy << "\n";
      return 0;
    }
    sx.insert(x2[i]);
    fx.insert(x1[i]);
    sy.insert(y2[i]);
    fy.insert(y1[i]);
  }
  return 0;
}
