#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5 + 5;
int n, xs, ys, lazy[4 * MAX];
pair<int, int> tree[4 * MAX];
struct pt {
  int x, y;
} p[MAX];
struct event {
  int x, y1, y2, f;
  event(int x, int y1, int y2, int f) : x(x), y1(y1), y2(y2), f(f) {}
  bool operator<(const event &e) const {
    if (x != e.x) return x < e.x;
    return f > e.f;
  }
};
vector<event> e;
pair<int, int> merge(pair<int, int> a, pair<int, int> b) {
  pair<int, int> c = b;
  if (a.first > b.first) c = a;
  return c;
}
void build(int x, int st, int nd) {
  lazy[x] = 0;
  if (st == nd) {
    tree[x] = {0, st};
    return;
  }
  int mid = (st + nd) >> 1;
  build(2 * x, st, mid);
  build(2 * x + 1, mid + 1, nd);
  tree[x] = merge(tree[2 * x], tree[2 * x + 1]);
}
void prop(int x, int st, int nd) {
  tree[x].first += lazy[x];
  if (st != nd) {
    lazy[2 * x] += lazy[x];
    lazy[2 * x + 1] += lazy[x];
  }
  lazy[x] = 0;
}
void upd(int x, int st, int nd, int a, int b, int v) {
  prop(x, st, nd);
  if (st > b || nd < a) return;
  if (st >= a && nd <= b) {
    lazy[x] = v;
    prop(x, st, nd);
    return;
  }
  int mid = (st + nd) >> 1;
  upd(2 * x, st, mid, a, b, v);
  upd(2 * x + 1, mid + 1, nd, a, b, v);
  tree[x] = merge(tree[2 * x], tree[2 * x + 1]);
}
int main() {
  scanf("%d", &n);
  vector<int> v;
  for (int i = 1; i <= n; i++) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    v.push_back(y1);
    v.push_back(y2);
    e.push_back(event(x1, y1, y2, +1));
    e.push_back(event(x2, y1, y2, -1));
  }
  sort(v.begin(), v.end());
  auto it = unique(v.begin(), v.end());
  v.erase(it, v.end());
  sort(e.begin(), e.end());
  build(1, 1, (int)v.size());
  for (auto &o : e) {
    o.y1 = lower_bound(v.begin(), v.end(), o.y1) - v.begin() + 1;
    o.y2 = lower_bound(v.begin(), v.end(), o.y2) - v.begin() + 1;
  }
  for (auto o : e) {
    upd(1, 1, (int)v.size(), o.y1, o.y2, o.f);
    auto q = tree[1];
    if (q.first >= n - 1) {
      xs = o.x;
      ys = q.second;
      printf("%d %d\n", xs, v[ys - 1]);
      return 0;
    }
  }
  assert(false);
  return 0;
}
