#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, z, k, w, ok;
int A[150005], B[150005], C[150005], D[150005];
int a, b, c, d;
int intercept(int aa, int bb, int cc, int dd) {
  if (a > cc || b > dd || c < aa || d < bb) return 0;
  a = max(a, aa);
  c = min(c, cc);
  b = max(b, bb);
  d = min(d, dd);
  return 1;
}
int main() {
  scanf("%d", &n);
  a = b = -1000000000;
  c = d = 1000000000;
  w = -1;
  for (int i = (0); i < (n); i++) {
    scanf("%d %d %d %d", &A[i], &B[i], &C[i], &D[i]);
  }
  for (int i = (0); i < (n); i++) {
    if (intercept(A[i], B[i], C[i], D[i]) == 0) {
      w = i;
      break;
    }
  }
  if (w == -1) {
    printf("%d %d\n", a, b);
    return 0;
  }
  a = b = -1000000000;
  c = d = 1000000000;
  ok = 1;
  for (int i = (0); i < (n); i++) {
    if (i == w) continue;
    if (intercept(A[i], B[i], C[i], D[i]) == 0) {
      ok = 0;
      break;
    }
  }
  if (ok == 1) {
    printf("%d %d\n", a, b);
    return 0;
  }
  for (int i = (0); i < (n); i++) {
    a = A[w];
    b = B[w];
    c = C[w];
    d = D[w];
    if (intercept(A[i], B[i], C[i], D[i]) == 0) {
      w = i;
      break;
    }
  }
  a = b = -1000000000;
  c = d = 1000000000;
  for (int i = (0); i < (n); i++) {
    if (i == w) continue;
    intercept(A[i], B[i], C[i], D[i]);
  }
  printf("%d %d\n", a, b);
  return 0;
}
