#include <bits/stdc++.h>
using namespace std;
inline void re(int &x) {
  x = 0;
  bool flag = false;
  char c = getchar();
  while (c < '0' || c > '9') {
    flag = c == '-';
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ '0');
    c = getchar();
  }
  if (flag) x = -x;
  return;
}
int mx[280010 << 2];
int lazy[280010 << 2];
void update(int root) {
  mx[root] = max(mx[root << 1], mx[root << 1 | 1]);
  return;
}
void pushdown(int root, int l, int r) {
  lazy[root << 1] += lazy[root];
  lazy[root << 1 | 1] += lazy[root];
  mx[root << 1] += lazy[root];
  mx[root << 1 | 1] += lazy[root];
  lazy[root] = 0;
  return;
}
void add(int root, int l, int r, int x, int y, int ad) {
  if (x <= l && r <= y) {
    lazy[root] += ad;
    mx[root] += ad;
    return;
  }
  pushdown(root, l, r);
  int mid = (l + r) >> 1;
  if (x <= mid) add(root << 1, l, mid, x, y, ad);
  if (y > mid) add(root << 1 | 1, mid + 1, r, x, y, ad);
  update(root);
  return;
}
int haha[280010];
int findk(int root, int l, int r, int k) {
  if (l == r) return haha[l];
  int mid = (l + r) >> 1;
  pushdown(root, l, r);
  if (mx[root << 1] == k) return findk(root << 1, l, mid, k);
  return findk(root << 1 | 1, mid + 1, r, k);
}
struct Nod {
  int x;
  int y1, y2;
  int flag;
} nod[280010];
bool cmp(Nod a, Nod b) { return a.x < b.x; }
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x1, x2, y1, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    nod[i * 2 - 1] = (Nod){x1, y1, y2, 0};
    nod[i * 2] = (Nod){x2 + 1, y1, y2, 1};
    haha[i * 2 - 1] = y1;
    haha[i * 2] = y2;
  }
  sort(haha + 1, haha + n * 2 + 1);
  sort(nod + 1, nod + n * 2 + 1, cmp);
  int last = 0;
  for (int i = 1; i <= 2 * n; i++) {
    if (nod[i].x > last && mx[1] >= n - 1) {
      printf("%d %d\n", last, findk(1, 1, n * 2, mx[1]));
      return 0;
    }
    last = nod[i].x;
    if (nod[i].flag == 0)
      add(1, 1, n * 2,
          lower_bound(haha + 1, haha + n * 2 + 1, nod[i].y1) - haha,
          lower_bound(haha + 1, haha + n * 2 + 1, nod[i].y2) - haha, 1);
    else
      add(1, 1, n * 2,
          lower_bound(haha + 1, haha + n * 2 + 1, nod[i].y1) - haha,
          lower_bound(haha + 1, haha + n * 2 + 1, nod[i].y2) - haha, -1);
  }
  cout << "0 0\n";
  return 0;
}
