#include <bits/stdc++.h>
using namespace std;
long long int M = 1e9 + 7;
long long int cdiv(long long int a, long long int b) {
  return (a % b == 0) ? a / b : a / b + 1;
}
long long int myMod(long long int a, long long int b) {
  long long int r = a % b;
  return r < 0 ? r + b : r;
}
long long int ModPow(long long int a, long long int b, long long int M) {
  if (M == 1) return 0;
  a %= M;
  long long int ans = 1, t = 1;
  while (t > 0 && t <= b) {
    if (t & b) {
      ans *= a;
      ans %= M;
    }
    t <<= 1;
    a *= a;
    a %= M;
  }
  return ans;
}
struct seg {
  long long int l, r, u, d;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  seg a[n];
  for (long long int i = 0; i < n; i++)
    cin >> a[i].l >> a[i].d >> a[i].r >> a[i].u;
  long long int mxll[n], mxlr[n], mnrl[n], mnrr[n];
  mxll[0] = a[0].l, mxlr[n - 1] = a[n - 1].l, mnrl[0] = a[0].r,
  mnrr[n - 1] = a[n - 1].r;
  for (long long int i = 1; i < n; i++) {
    mxll[i] = max(mxll[i - 1], a[i].l);
    mnrl[i] = min(mnrl[i - 1], a[i].r);
  }
  for (long long int i = n - 1 - 1; i >= 0; i--) {
    mxlr[i] = max(mxlr[i + 1], a[i].l);
    mnrr[i] = min(mnrr[i + 1], a[i].r);
  }
  long long int mxdl[n], mxdr[n], mnul[n], mnur[n];
  mxdl[0] = a[0].d, mxdr[n - 1] = a[n - 1].d, mnul[0] = a[0].u,
  mnur[n - 1] = a[n - 1].u;
  for (long long int i = 1; i < n; i++) {
    mxdl[i] = max(mxdl[i - 1], a[i].d);
    mnul[i] = min(mnul[i - 1], a[i].u);
  }
  for (long long int i = n - 1 - 1; i >= 0; i--) {
    mxdr[i] = max(mxdr[i + 1], a[i].d);
    mnur[i] = min(mnur[i + 1], a[i].u);
  }
  if (mnrr[1] - mxlr[1] >= 0 && mnur[1] - mxdr[1] >= 0) {
    cout << mxlr[1] << " " << mxdr[1] << "\n";
    return 0;
  }
  for (long long int i = 1; i < n - 1; i++) {
    long long int cix =
        min(mnrl[i - 1], mnrr[i + 1]) - max(mxll[i - 1], mxlr[i + 1]);
    long long int ciy =
        min(mnul[i - 1], mnur[i + 1]) - max(mxdl[i - 1], mxdr[i + 1]);
    if (cix >= 0 && ciy >= 0) {
      cout << max(mxll[i - 1], mxlr[i + 1]) << " "
           << max(mxdl[i - 1], mxdr[i + 1]);
      return 0;
    }
  }
  if (mnrl[n - 2] - mxll[n - 2] >= 0 && mnul[n - 2] - mxdl[n - 2] >= 0) {
    cout << mxll[n - 2] << " " << mxdl[n - 2] << "\n";
    return 0;
  }
  return 0;
}
