#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
int xx1[N];
int xx2[N];
int yy1[N];
int yy2[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed;
  cout.precision(12);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> xx1[i] >> yy1[i] >> xx2[i] >> yy2[i];
  }
  vector<int> cands;
  cands.push_back(-1);
  int INF = 1000000002;
  {
    int mnx = -INF;
    int mny = -INF;
    int mxx = INF;
    int mxy = INF;
    for (int i = 0; i < n; i++) {
      mnx = max(mnx, xx1[i]);
      mny = max(mny, yy1[i]);
      mxx = min(mxx, xx2[i]);
      mxy = min(mxy, yy2[i]);
      if (mnx > mxx || mny > mxy) {
        cands.push_back(i);
        break;
      }
    }
  }
  {
    int mnx = -INF;
    int mny = -INF;
    int mxx = INF;
    int mxy = INF;
    for (int i = n - 1; i >= 0; i--) {
      mnx = max(mnx, xx1[i]);
      mny = max(mny, yy1[i]);
      mxx = min(mxx, xx2[i]);
      mxy = min(mxy, yy2[i]);
      if (mnx > mxx || mny > mxy) {
        cands.push_back(i);
        break;
      }
    }
  }
  for (int j : cands) {
    int mnx = -INF;
    int mny = -INF;
    int mxx = INF;
    int mxy = INF;
    for (int i = n - 1; i >= 0; i--) {
      if (i == j) continue;
      mnx = max(mnx, xx1[i]);
      mny = max(mny, yy1[i]);
      mxx = min(mxx, xx2[i]);
      mxy = min(mxy, yy2[i]);
    }
    if (mnx <= mxx && mny <= mxy) {
      cout << mnx << " " << mny << endl;
      return 0;
    }
  }
  return 0;
}
