#include <bits/stdc++.h>
using namespace std;
inline int iin() {
  int x;
  scanf("%d", &x);
  return x;
}
inline long long int lin() {
  long long int x;
  scanf("%lld", &x);
  return x;
}
inline long long int Lin() {
  long long int x;
  scanf("%I64d", &x);
  return x;
}
inline int iout(int x) { printf("%d", x); }
inline long long int lout(long long int x) { printf("%lld", x); }
inline long long int Lout(long long int x) { printf("%I64d", x); }
const int maxn4 = 1e4 + 85, maxn5 = 1e5 + 69, maxn6 = 1e6 + 85,
          maxn7 = 1e7 + 69, maxn8 = 1e8 + 85, maxn9 = 1e9 + 69, modi1 = 1e7 + 7,
          modi2 = 1e9 + 7;
const long long int mod1 = 1e7 + 7, mod2 = 1e9 + 7;
int mn = INT_MAX, mx = INT_MIN;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n, i, xfirst, xlast, yfirst, ylast;
  multiset<long long int> xf, xl, yf, yl;
  cin >> n;
  long long int x1[n + 1], x2[n + 1], y1[n + 1], y2[n + 1];
  for (i = 0; i < n; i++) {
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    xf.insert(x1[i]);
    yf.insert(y1[i]);
    xl.insert(x2[i]);
    yl.insert(y2[i]);
  }
  for (int i = 0; i < n; i++) {
    xf.erase(xf.find(x1[i]));
    xl.erase(xl.find(x2[i]));
    yf.erase(yf.find(y1[i]));
    yl.erase(yl.find(y2[i]));
    xfirst = *(xf.rbegin());
    xlast = *(xl.begin());
    yfirst = *(yf.rbegin());
    ylast = *(yl.begin());
    if (xfirst <= xlast && yfirst <= ylast)
      return cout << xfirst << ' ' << yfirst, 0;
    else {
      xf.insert(x1[i]);
      yf.insert(y1[i]);
      xl.insert(x2[i]);
      yl.insert(y2[i]);
    }
  }
}
