#include <bits/stdc++.h>
const double EPS = 1e-9;
using namespace std;
inline int nxt() {
  int wow;
  scanf("%d", &wow);
  return wow;
}
struct point {
  int x, y;
  point(int xx, int yy) { x = xx, y = yy; }
  point() {}
};
struct rec {
  point a, b, c, d;
  rec() {}
  rec(point dl, point ur) {
    b = dl, d = ur;
    a.x = b.x, a.y = d.y;
    c.x = d.x, c.y = b.y;
  }
};
rec r[200002];
bool comp(rec one, rec two) {
  if (one.a.x == two.a.x) return one.b.y < two.b.y;
  return one.a.x < two.a.x;
}
int main() {
  int n = nxt();
  for (int i = 0; i < n; i++) {
    point b, d;
    b.x = nxt(), b.y = nxt();
    d.x = nxt(), d.y = nxt();
    rec temp(b, d);
    r[i] = temp;
  }
  sort(r, r + n, comp);
  int cur = r[0].c.x;
  pair<int, int> idx(0, -1);
  int crap = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (r[i].c.x < crap) {
      crap = r[i].c.x;
      idx.first = i;
    }
  }
  for (int i = 1; i < n; i++) {
    if (r[i].a.x > crap) {
      idx.second = i;
      break;
    }
  }
  if (idx.second == -1) {
    idx.first = 0;
    crap = r[0].a.y;
    for (int i = 0; i < n; i++) {
      if (r[i].a.y < crap) {
        crap = r[i].a.y;
        idx.first = i;
      }
    }
    for (int i = 1; i < n; i++) {
      if (r[i].b.y > crap) {
        idx.second = i;
        break;
      }
    }
  }
  int cnt = 0, flag = 0;
  int bx = INT_MIN, cx = INT_MAX, by = INT_MIN, ay = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (i == idx.first) continue;
    bx = max(bx, r[i].b.x);
    cx = min(cx, r[i].c.x);
    by = max(by, r[i].b.y);
    ay = min(ay, r[i].a.y);
  }
  if (bx <= cx && by <= ay) {
    cout << bx << ' ' << by << endl;
    return 0;
  }
  bx = INT_MIN, cx = INT_MAX, by = INT_MIN, ay = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (i == idx.second) continue;
    bx = max(bx, r[i].b.x);
    cx = min(cx, r[i].c.x);
    by = max(by, r[i].b.y);
    ay = min(ay, r[i].a.y);
  }
  if (bx <= cx && by <= ay) {
    cout << bx << ' ' << by << endl;
    return 0;
  }
  return 0;
}
