#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e5 + 5;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int xl[N], yl[N], xr[N], yr[N];
int prexl[N], preyl[N], prexr[N], preyr[N];
int sufxl[N], sufxr[N], sufyl[N], sufyr[N];
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  prexl[0] = preyl[0] = sufxl[n + 1] = sufyl[n + 1] = -1e+9;
  sufxr[n + 1] = sufyr[n + 1] = prexr[0] = preyr[0] = 1e+9;
  for (int i = 1; i < n + 1; i++) {
    cin >> xl[i] >> yl[i] >> xr[i] >> yr[i];
    prexl[i] = max(prexl[i - 1], xl[i]);
    preyl[i] = max(preyl[i - 1], yl[i]);
    prexr[i] = min(prexr[i - 1], xr[i]);
    preyr[i] = min(preyr[i - 1], yr[i]);
  }
  for (int i = n; i >= 1; i--) {
    sufxl[i] = max(sufxl[i + 1], xl[i]);
    sufyl[i] = max(sufyl[i + 1], yl[i]);
    sufxr[i] = min(sufxr[i + 1], xr[i]);
    sufyr[i] = min(sufyr[i + 1], yr[i]);
  }
  for (int i = 1; i < n + 1; i++) {
    int lx, ly, rx, ry;
    lx = max(prexl[i - 1], sufxl[i + 1]);
    ly = max(preyl[i - 1], sufyl[i + 1]);
    rx = min(prexr[i - 1], sufxr[i + 1]);
    ry = min(preyr[i - 1], sufyr[i + 1]);
    if (lx > rx || ly > ry)
      continue;
    else {
      cout << lx << " " << ly << endl;
      break;
    }
  }
  return 0;
}
