#include <bits/stdc++.h>
using namespace std;
long long int x[200005], y[200005];
long long int n;
vector<pair<long long int, pair<long long int, long long int>>> X, Y;
set<long long int> s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i <= n; i++) x[i] = y[i] = 1e18;
  for (int i = 1; i <= n; i++) {
    long long int l, r, l1, r1;
    cin >> l >> r >> l1 >> r1;
    X.push_back({l, {1, i}});
    X.push_back({l1 + 1, {0, i}});
    Y.push_back({r, {1, i}});
    Y.push_back({r1 + 1, {0, i}});
  }
  sort(X.begin(), X.end());
  sort(Y.begin(), Y.end());
  for (int i = 1; i <= n; i++) s.insert(i);
  long long int i = 0, j = 0;
  while (i < X.size() && j < X.size()) {
    while (j < X.size() && X[i].first == X[j].first) j++;
    for (int h = i; h < j; h++) {
      auto k = X[h];
      if (k.second.first)
        s.erase(k.second.second);
      else
        s.insert(k.second.second);
    }
    long long int pos = 0;
    if (s.size() <= 1) {
      if (s.size()) pos = *s.begin();
      x[pos] = X[i].first;
    }
    i = j;
  }
  s.clear();
  for (int i = 1; i <= n; i++) s.insert(i);
  i = 0, j = 0;
  while (i < Y.size() && j < Y.size()) {
    while (j < Y.size() && Y[i].first == Y[j].first) j++;
    for (int h = i; h < j; h++) {
      auto k = Y[h];
      if (k.second.first)
        s.erase(k.second.second);
      else
        s.insert(k.second.second);
    }
    long long int pos = 0;
    if (s.size() <= 1) {
      if (s.size()) pos = *s.begin();
      y[pos] = Y[i].first;
    }
    i = j;
  }
  for (int i = 1; i <= n; i++) {
    if (x[i] == 1e18) x[i] = x[0];
    if (y[i] == 1e18) y[i] = y[0];
  }
  for (int i = 0; i <= n; i++)
    if (x[i] != 1e18 && y[i] != 1e18)
      return cout << x[i] << " " << y[i] << '\n', 0;
  return 0;
}
