#include <bits/stdc++.h>
using namespace std;
multiset<int> xlow, xhigh, ylow, yhigh;
int xlowp[1000001], xhighp[1000001], ylowp[1000001], yhighp[1000001];
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> xlowp[i] >> ylowp[i] >> xhighp[i] >> yhighp[i];
    xlow.insert(xlowp[i]);
    xhigh.insert(xhighp[i]);
    ylow.insert(ylowp[i]);
    yhigh.insert(yhighp[i]);
  }
  for (i = 0; i < n; i++) {
    xlow.erase(xlow.find(xlowp[i]));
    ylow.erase(ylow.find(ylowp[i]));
    xhigh.erase(xhigh.find(xhighp[i]));
    yhigh.erase(yhigh.find(yhighp[i]));
    if (*xlow.rbegin() <= *xhigh.begin() && *ylow.rbegin() <= *yhigh.begin()) {
      cout << *xlow.rbegin() << " " << *ylow.rbegin();
      return 0;
    }
    xlow.insert(xlowp[i]);
    xhigh.insert(xhighp[i]);
    ylow.insert(ylowp[i]);
    yhigh.insert(yhighp[i]);
  }
  return 0;
}
