#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const long long inf = 2147483647;
int n, m, k;
long long ans, x, y, tmp, cnt;
struct node {
  long long xl, yl, xr, yr;
} a[maxn], aa, l[maxn], r[maxn];
bool jud(node aa) {
  if (aa.xl > aa.xr) return 0;
  if (aa.yl > aa.yr)
    return 0;
  else
    return 1;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++)
      scanf("%lld%lld%lld%lld", &a[i].xl, &a[i].yl, &a[i].xr, &a[i].yr);
    l[0].xl = l[0].yl = -inf;
    l[0].xr = l[0].yr = inf;
    for (int i = 1; i <= n; i++) {
      l[i].xl = max(a[i].xl, l[i - 1].xl);
      l[i].yl = max(a[i].yl, l[i - 1].yl);
      l[i].xr = min(a[i].xr, l[i - 1].xr);
      l[i].yr = min(a[i].yr, l[i - 1].yr);
    }
    r[n + 1].xl = r[n + 1].yl = -inf;
    r[n + 1].xr = r[n + 1].yr = inf;
    for (int i = n; i >= 1; i--) {
      r[i].xl = max(a[i].xl, r[i + 1].xl);
      r[i].yl = max(a[i].yl, r[i + 1].yl);
      r[i].xr = min(a[i].xr, r[i + 1].xr);
      r[i].yr = min(a[i].yr, r[i + 1].yr);
    }
    if (jud(l[n - 1])) {
      printf("%lld %lld\n", l[n - 1].xl, l[n - 1].yl);
    } else if (jud(r[2])) {
      printf("%lld %lld\n", r[2].xl, r[2].yl);
    } else
      for (int i = 2; i <= n - 1; i++) {
        aa.xl = max(l[i - 1].xl, r[i + 1].xl);
        aa.yl = max(l[i - 1].yl, r[i + 1].yl);
        aa.xr = min(l[i - 1].xr, r[i + 1].xr);
        aa.yr = min(l[i - 1].yr, r[i + 1].yr);
        if (jud(aa)) {
          printf("%lld %lld\n", aa.xl, aa.yl);
          break;
        }
      }
  }
  return 0;
}
