#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
struct info {
  int lx, rx, ly, ry;
  info() {}
  info(int x1, int y1, int x2, int y2) { lx = x1, rx = x2, ly = y1, ry = y2; }
  void input() { cin >> lx >> ly >> rx >> ry; }
  info operator&&(info r) {
    return info(max(lx, r.lx), max(ly, r.ly), min(rx, r.rx), min(ry, r.ry));
  }
  bool Q() { return lx <= rx && ly <= ry; }
};
int n;
info A[2 * 100000], B[2 * 100000], C[2 * 100000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) A[i].input();
  B[0] = C[n + 1] = {-INF, -INF, INF, INF};
  for (int i = 1; i <= n; i++) B[i] = B[i - 1] && A[i];
  for (int i = n; i >= 0; i--) C[i] = C[i + 1] && A[i];
  for (int i = 1; i <= n; i++) {
    info x = B[i - 1] && C[i + 1];
    if (x.Q()) {
      cout << x.lx << " " << x.ly << endl;
      return 0;
    }
  }
}
