#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int intcmp(const void *v1, const void *v2) { return *(int *)v1 - *(int *)v2; }
inline int read() {
  int x = 0, f = 1;
  char cc = getchar();
  while (cc < '0' || cc > '9') {
    if (cc == '-') f = -1;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    x = x * 10 + cc - '0';
    cc = getchar();
  }
  return x * f;
}
const int maxn = 200010;
int lx1[maxn], ly1[maxn], rx1[maxn], ry1[maxn], lx2[maxn], ly2[maxn], rx2[maxn],
    ry2[maxn];
int px[maxn], py[maxn], qx[maxn], qy[maxn], n;
int main() {
  n = read();
  for (int i = 1; i < n + 1; i++) {
    scanf("%d %d %d %d", px + i, py + i, qx + i, qy + i);
  }
  lx1[0] = -inf;
  rx1[0] = inf;
  ly1[0] = -inf;
  ry1[0] = inf;
  for (int i = 1; i < n + 1; i++) {
    lx1[i] = max(lx1[i - 1], px[i]);
    ly1[i] = max(ly1[i - 1], py[i]);
    rx1[i] = min(rx1[i - 1], qx[i]);
    ry1[i] = min(ry1[i - 1], qy[i]);
  }
  lx2[n + 1] = -inf;
  rx2[n + 1] = inf;
  ly2[n + 1] = -inf;
  ry2[n + 1] = inf;
  for (int i = n + 1 - 1; i >= 1; i--) {
    lx2[i] = max(lx2[i + 1], px[i]);
    ly2[i] = max(ly2[i + 1], py[i]);
    rx2[i] = min(rx2[i + 1], qx[i]);
    ry2[i] = min(ry2[i + 1], qy[i]);
  }
  for (int i = 1; i < n + 1; i++) {
    int lx0 = max(lx1[i - 1], lx2[i + 1]);
    int ly0 = max(ly1[i - 1], ly2[i + 1]);
    int rx0 = min(rx1[i - 1], rx2[i + 1]);
    int ry0 = min(ry1[i - 1], ry2[i + 1]);
    if (lx0 <= rx0 && ly0 <= ry0) {
      printf("%d %d\n", lx0, ly0);
      return 0;
    }
  }
}
