#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200000;
int lx[MAXN], ly[MAXN];
int rx[MAXN], ry[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> possible_x, possible_y;
  auto test = [&](int x, int y) {
    int cnt = 0;
    for (int i = 0; i < n; ++i)
      cnt += lx[i] <= x and x <= rx[i] and ly[i] <= y and y <= ry[i];
    return cnt >= n - 1;
  };
  auto get_card = [&](vector<pair<int, int>> event, vector<int> &sample) {
    sort(event.begin(), event.end(), [](pair<int, int> A, pair<int, int> B) {
      return A.first == B.first ? A.second > B.second : A.first < B.first;
    });
    int cur = 0;
    for (auto P : event) {
      int t = P.first, d = P.second;
      if (d == 1) ++cur;
      if (cur >= n - 1) sample.push_back(t);
      if (d == -1) --cur;
    }
  };
  for (int i = 0; i < n; ++i) {
    cin >> lx[i] >> ly[i] >> rx[i] >> ry[i];
  }
  vector<pair<int, int>> event;
  event.clear();
  for (int i = 0; i < n; ++i) {
    event.emplace_back(lx[i], 1);
    event.emplace_back(rx[i], -1);
  }
  get_card(event, possible_x);
  event.clear();
  for (int i = 0; i < n; ++i) {
    event.emplace_back(ly[i], 1);
    event.emplace_back(ry[i], -1);
  }
  get_card(event, possible_y);
  possible_x.resize(unique(possible_x.begin(), possible_x.end()) -
                    possible_x.begin());
  possible_y.resize(unique(possible_y.begin(), possible_y.end()) -
                    possible_y.begin());
  for (int x : possible_x)
    for (int y : possible_y) {
      if (test(x, y)) {
        return cout << x << ' ' << y << '\n', 0;
      }
    }
  assert(0);
}
