#include <bits/stdc++.h>
using namespace std;
const int N = 132700;
int n;
tuple<int, int, int, int> esq[N], dir[N];
vector<tuple<int, int, int, int>> v;
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    v.emplace_back(a, b, c, d);
  }
  esq[0] = make_tuple(-0x3f3f3f3f, -0x3f3f3f3f, +0x3f3f3f3f, +0x3f3f3f3f);
  for (int i = 1; i <= n; i++) {
    int xb, yb, xu, yu;
    tie(xb, yb, xu, yu) = v[i - 1];
    get<0>(esq[i]) = max(get<0>(esq[i - 1]), xb);
    get<1>(esq[i]) = max(get<1>(esq[i - 1]), yb);
    get<2>(esq[i]) = min(get<2>(esq[i - 1]), xu);
    get<3>(esq[i]) = min(get<3>(esq[i - 1]), yu);
  }
  dir[n + 1] = make_tuple(-0x3f3f3f3f, -0x3f3f3f3f, +0x3f3f3f3f, +0x3f3f3f3f);
  for (int i = n; i >= 1; i--) {
    int xb, yb, xu, yu;
    tie(xb, yb, xu, yu) = v[i - 1];
    get<0>(dir[i]) = max(get<0>(dir[i + 1]), xb);
    get<1>(dir[i]) = max(get<1>(dir[i + 1]), yb);
    get<2>(dir[i]) = min(get<2>(dir[i + 1]), xu);
    get<3>(dir[i]) = min(get<3>(dir[i + 1]), yu);
  }
  for (int i = 1; i <= n; i++) {
    int xb, yb, xu, yu;
    xb = max(get<0>(esq[i - 1]), get<0>(dir[i + 1]));
    yb = max(get<1>(esq[i - 1]), get<1>(dir[i + 1]));
    xu = min(get<2>(esq[i - 1]), get<2>(dir[i + 1]));
    yu = min(get<3>(esq[i - 1]), get<3>(dir[i + 1]));
    if (xb <= xu and yb <= yu) {
      cout << xb << " " << yb << endl;
      return 0;
    }
  }
  assert(0);
  return 0;
}
