#include <bits/stdc++.h>
using namespace std;
struct rectangle {
  long long int x1, y1, x2, y2;
};
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<rectangle> printx(n + 2);
  vector<rectangle> sufintx(n + 2);
  vector<rectangle> current(n + 1);
  struct rectangle r;
  r.x1 = -1e9, r.y1 = -1e9, r.x2 = 1e9, r.y2 = 1e9;
  printx[0] = r;
  sufintx[n + 1] = r;
  for (long long int i = 1; i <= n; i++) {
    long long int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    r.x1 = x1, r.y1 = y1, r.x2 = x2, r.y2 = y2;
    current[i] = r;
  }
  struct rectangle curr, prev, inx;
  for (long long int i = 1; i <= n; i++) {
    curr = current[i];
    prev = printx[i - 1];
    inx.x1 = max(curr.x1, prev.x1);
    inx.y1 = max(curr.y1, prev.y1);
    inx.x2 = min(curr.x2, prev.x2);
    inx.y2 = min(curr.y2, prev.y2);
    printx[i] = inx;
  }
  for (long long int i = n; i >= 1; i--) {
    curr = current[i];
    prev = sufintx[i + 1];
    inx.x1 = max(curr.x1, prev.x1);
    inx.y1 = max(curr.y1, prev.y1);
    inx.x2 = min(curr.x2, prev.x2);
    inx.y2 = min(curr.y2, prev.y2);
    sufintx[i] = inx;
  }
  struct rectangle r1, r2;
  for (long long int i = 1; i <= n; i++) {
    r1 = printx[i - 1];
    r2 = sufintx[i + 1];
    inx.x1 = max(r1.x1, r2.x1);
    inx.y1 = max(r1.y1, r2.y1);
    inx.x2 = min(r1.x2, r2.x2);
    inx.y2 = min(r1.y2, r2.y2);
    if (inx.x1 <= inx.x2 && inx.y1 <= inx.y2) {
      cout << inx.x1 << " " << inx.y1;
      return 0;
    }
  }
}
