#include <bits/stdc++.h>
class rect_t {
 public:
  rect_t(int xx0, int yy0, int xx1, int yy1)
      : x0(xx0), y0(yy0), x1(xx1), y1(yy1){};

 public:
  bool rect_is_valid() const { return x0 <= x1 && y0 <= y1; };

 public:
  int x0;
  int y0;
  int x1;
  int y1;
};
class rect_fn_t {
 public:
  rect_fn_t(rect_t& rect) : rect_(rect){};

 public:
  void intersect(const rect_t& r) {
    rect_.x0 = std::max(rect_.x0, r.x0);
    rect_.y0 = std::max(rect_.y0, r.y0);
    rect_.x1 = std::min(rect_.x1, r.x1);
    rect_.y1 = std::min(rect_.y1, r.y1);
  };

 private:
  rect_t& rect_;
};
int main(int argc, char** argv) {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);
  int n, x0, y0, x1, y1;
  std::cin >> n;
  std::vector<rect_t> a;
  for (int i = 0; i < n; i++) {
    std::cin >> x0 >> y0 >> x1 >> y1;
    a.emplace_back(x0, y0, x1, y1);
  }
  std::vector<rect_t> b;
  rect_t r(a[0]);
  rect_fn_t fn(r);
  for (int i = 0; i < n; i++) {
    fn.intersect(a[i]);
    b.push_back(r);
  }
  a.emplace_back(-1234567890, -1234567890, 1234567890, 1234567890);
  r = a[n];
  for (int i = n; i >= 0; i--) {
    fn.intersect(a[i]);
    rect_t rr(r);
    if (i - 2 >= 0) {
      rect_fn_t fn2(rr);
      fn2.intersect(b[i - 2]);
    }
    if (rr.rect_is_valid()) {
      std::cout << rr.x0 << ' ' << rr.y0 << std::endl;
      break;
    }
  }
  return 0;
}
