#include <bits/stdc++.h>
using namespace std;
const int N = 132675, INF = 1e9 + 1;
int n;
struct rec {
  int xl, yl, xr, yr;
} a[N];
multiset<int> xs, xe, ys, ye;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int xa = -INF, ya = -INF, xb = INF, yb = INF;
  for (int i = 0; i < n; i++) {
    cin >> a[i].xl >> a[i].yl >> a[i].xr >> a[i].yr;
    xs.insert(a[i].xl);
    ys.insert(a[i].yl);
    xe.insert(a[i].xr);
    ye.insert(a[i].yr);
  }
  xa = *xs.rbegin();
  ya = *ys.rbegin();
  xb = *xe.begin();
  yb = *ye.begin();
  if (xb >= xa && yb >= ya) {
    cout << xa << " " << ya << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    xs.erase(xs.find(a[i].xl));
    ys.erase(ys.find(a[i].yl));
    xe.erase(xe.find(a[i].xr));
    ye.erase(ye.find(a[i].yr));
    xa = *xs.rbegin();
    ya = *ys.rbegin();
    xb = *xe.begin();
    yb = *ye.begin();
    if (xb >= xa && yb >= ya) {
      cout << xa << " " << ya << "\n";
      return 0;
    }
    xs.insert(a[i].xl);
    ys.insert(a[i].yl);
    xe.insert(a[i].xr);
    ye.insert(a[i].yr);
  }
}
