#include <bits/stdc++.h>
using namespace std;
struct rect {
  int x1, y1, x2, y2;
  rect(int xl, int yl, int xu, int yu) { x1 = xl, y1 = yl, x2 = xu, y2 = yu; }
  rect() { x1 = x2 = y1 = y2 = 0; }
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  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];
  rect pref[n], suff[n];
  pref[0] = {x1[0], y1[0], x2[0], y2[0]};
  for (int i = (1); i < (n); i++) {
    pref[i] = {max(x1[i], pref[i - 1].x1), max(y1[i], pref[i - 1].y1),
               min(x2[i], pref[i - 1].x2), min(y2[i], pref[i - 1].y2)};
  }
  suff[n - 1] = {x1[n - 1], y1[n - 1], x2[n - 1], y2[n - 1]};
  for (int i = n - 2; i >= 0; i--) {
    suff[i] = {max(x1[i], suff[i + 1].x1), max(y1[i], suff[i + 1].y1),
               min(x2[i], suff[i + 1].x2), min(y2[i], suff[i + 1].y2)};
  }
  int flag = 0;
  for (int i = (1); i < (n - 1); i++) {
    rect intsct = {max(pref[i - 1].x1, suff[i + 1].x1),
                   max(pref[i - 1].y1, suff[i + 1].y1),
                   min(pref[i - 1].x2, suff[i + 1].x2),
                   min(pref[i - 1].y2, suff[i + 1].y2)};
    if (intsct.x2 >= intsct.x1 && intsct.y2 >= intsct.y1) {
      cout << intsct.x1 << " " << intsct.y1 << "\n";
      flag = 1;
      break;
    }
  }
  if (!flag) {
    rect intsct = suff[1];
    if (intsct.x2 >= intsct.x1 && intsct.y2 >= intsct.y1) {
      cout << intsct.x1 << " " << intsct.y1 << "\n";
    } else {
      rect intsct = pref[n - 2];
      if (intsct.x2 >= intsct.x1 && intsct.y2 >= intsct.y1) {
        cout << intsct.x1 << " " << intsct.y1 << "\n";
      }
    }
  }
}
