#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 69, base = 1024 * 1024, mod = 1e9 + 7;
int n;
tuple<int, int, int, int> pref[N];
tuple<int, int, int, int> suma(tuple<int, int, int, int> a,
                               tuple<int, int, int, int> b) {
  tuple<int, int, int, int> re;
  get<0>(a) = max(get<0>(a), get<0>(b));
  get<1>(a) = max(get<1>(a), get<1>(b));
  get<2>(a) = min(get<2>(a), get<2>(b));
  get<3>(a) = min(get<3>(a), get<3>(b));
  return a;
}
void pisz(tuple<int, int, int, int> a) {
  if (get<0>(a) > get<2>(a)) return;
  if (get<1>(a) > get<3>(a)) return;
  cout << get<0>(a) << " ";
  cout << get<1>(a) << " ";
  exit(0);
}
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<tuple<int, int, int, int>> vek;
  for (int i = 0; i <= n - 1; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    vek.push_back({a, b, c, d});
    pref[i] = vek[i];
    if (i != 0) pref[i] = suma(pref[i], pref[i - 1]);
  }
  tuple<int, int, int, int> suf = vek.back();
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      pisz(pref[i - 1]);
    } else {
      suf = suma(suf, vek[i + 1]);
      if (i == 0)
        pisz(suf);
      else
        pisz(suma(suf, pref[i - 1]));
    }
  }
}
