#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int INF = 2e9;
int x[N][2], y[N][2];
int Xmxlpre[N], Xmxlsuf[N];
int Xmnrpre[N], Xmnrsuf[N];
int Ymxlpre[N], Ymxlsuf[N];
int Ymnrpre[N], Ymnrsuf[N];
int n;
int XsolveL(int s, int e) {
  if (s <= e) {
    if (s == 0) return Xmxlpre[e];
    return Xmxlsuf[s];
  }
  return -INF;
}
int XsolveR(int s, int e) {
  if (s <= e) {
    if (s == 0) return Xmnrpre[e];
    return Xmnrsuf[s];
  }
  return INF;
}
int YsolveL(int s, int e) {
  if (s <= e) {
    if (s == 0) return Ymxlpre[e];
    return Ymxlsuf[s];
  }
  return -INF;
}
int YsolveR(int s, int e) {
  if (s <= e) {
    if (s == 0) return Ymnrpre[e];
    return Ymnrsuf[s];
  }
  return INF;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < int(n); i++) {
    for (int j = 0; j < int(2); j++) scanf("%d %d", &x[i][j], &y[i][j]);
    if (x[i][0] > x[i][1]) swap(x[i][0], x[i][1]);
    if (y[i][0] > y[i][1]) swap(y[i][0], y[i][1]);
  }
  for (int i = 0; i < int(n); i++) {
    Xmxlpre[i] = max(x[i][0], i ? Xmxlpre[i - 1] : -INF);
    Xmnrpre[i] = min(x[i][1], i ? Xmnrpre[i - 1] : INF);
  }
  for (int i = 0; i < int(n); i++) {
    Ymxlpre[i] = max(y[i][0], i ? Ymxlpre[i - 1] : -INF);
    Ymnrpre[i] = min(y[i][1], i ? Ymnrpre[i - 1] : INF);
  }
  for (int i = int(n - 1); i >= 0; i--) {
    Xmxlsuf[i] = max(x[i][0], i + 1 < n ? Xmxlsuf[i + 1] : -INF);
    Xmnrsuf[i] = min(x[i][1], i + 1 < n ? Xmnrsuf[i + 1] : INF);
  }
  for (int i = int(n - 1); i >= 0; i--) {
    Ymxlsuf[i] = max(y[i][0], i + 1 < n ? Ymxlsuf[i + 1] : -INF);
    Ymnrsuf[i] = min(y[i][1], i + 1 < n ? Ymnrsuf[i + 1] : INF);
  }
  int ans = 0;
  for (int i = 0; i < int(n); i++) {
    int Lx = max(XsolveL(0, i - 1), XsolveL(i + 1, n - 1));
    int Ly = max(YsolveL(0, i - 1), YsolveL(i + 1, n - 1));
    int Rx = min(XsolveR(0, i - 1), XsolveR(i + 1, n - 1));
    int Ry = min(YsolveR(0, i - 1), YsolveR(i + 1, n - 1));
    if (Lx <= Rx && Ly <= Ry) {
      cout << Lx << " " << Ly << endl;
      return 0;
    }
  }
  return 0;
}
