#include <bits/stdc++.h>
using ul = std::uint32_t;
using ull = std::uint64_t;
using li = std::int32_t;
using ll = std::int64_t;
using vli = std::vector<li>;
const ul sz = 1 << 18;
void insert(li v, ul pos, vli& tree) {
  for (tree[pos = pos + sz] = v, pos >>= 1; pos; pos >>= 1) {
    tree[pos] = std::max(tree[pos << 1], tree[pos << 1 | 1]);
  }
}
li query(ul l, ul r, const vli& tree) {
  li ret = -1e9;
  if (l > r) {
    return -1e9;
  }
  for (l = l + sz - 1, r = r + sz + 1; l ^ r ^ ul(1); l >>= 1, r >>= 1) {
    if (~l & ul(1)) {
      ret = std::max(ret, tree[l ^ 1]);
    }
    if (r & ul(1)) {
      ret = std::max(ret, tree[r ^ 1]);
    }
  }
  return ret;
}
vli treeu(sz << 1, -1e9);
vli treeb(sz << 1, -1e9);
vli treel(sz << 1, -1e9);
vli treer(sz << 1, -1e9);
ul n;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cin >> n;
  for (ul i = 1; i <= n; ++i) {
    li l, b, r, u;
    std::cin >> l >> b >> r >> u;
    insert(l, i, treel);
    insert(b, i, treeb);
    insert(-r, i, treer);
    insert(-u, i, treeu);
  }
  for (ul i = 1; i <= n; ++i) {
    li l = std::max(query(1, i - 1, treel), query(i + 1, n, treel));
    li b = std::max(query(1, i - 1, treeb), query(i + 1, n, treeb));
    li r = -std::max(query(1, i - 1, treer), query(i + 1, n, treer));
    li u = -std::max(query(1, i - 1, treeu), query(i + 1, n, treeu));
    if (u >= b && r >= l) {
      std::cout << l << ' ' << b << std::endl;
      return 0;
    }
  }
  return 0;
}
