#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n, m, a, b, c, val = 0, ans, t, f, q, l, r, k, i, y1, j, x1, x, b1,
                           b2, e, x0, x2, y2, w, y, z, p, v, d, u, num,
                           maxval = LLONG_MIN;
  cin >> n;
  vector<pair<pair<long long, long long>, pair<long long, long long> > > arr(n),
      pre(n), suf(n);
  for (i = 0; i < n; i++)
    cin >> arr[i].first.first >> arr[i].first.second >> arr[i].second.first >>
        arr[i].second.second;
  pair<pair<long long, long long>, pair<long long, long long> > p1;
  pre[0] = arr[0];
  suf[n - 1] = arr[n - 1];
  for (i = 1; i < n; i++)
    pre[i] = {{max(pre[i - 1].first.first, arr[i].first.first),
               max(pre[i - 1].first.second, arr[i].first.second)},
              {min(pre[i - 1].second.first, arr[i].second.first),
               min(pre[i - 1].second.second, arr[i].second.second)}};
  for (i = n - 2; i >= 0; i--)
    suf[i] = {{max(suf[i + 1].first.first, arr[i].first.first),
               max(suf[i + 1].first.second, arr[i].first.second)},
              {min(suf[i + 1].second.first, arr[i].second.first),
               min(suf[i + 1].second.second, arr[i].second.second)}};
  for (i = 0; i < n; i++) {
    if (i == 0)
      p1 = suf[i + 1];
    else if (i == n - 1)
      p1 = pre[i - 1];
    else {
      p1.first.first = max(pre[i - 1].first.first, suf[i + 1].first.first);
      p1.first.second = max(pre[i - 1].first.second, suf[i + 1].first.second);
      p1.second.first = min(pre[i - 1].second.first, suf[i + 1].second.first);
      p1.second.second =
          min(pre[i - 1].second.second, suf[i + 1].second.second);
    }
    if (p1.first.first <= p1.second.first &&
        p1.first.second <= p1.second.second) {
      cout << p1.first.first << " " << p1.first.second << "\n";
      return 0;
    }
  }
  return 0;
}
