#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int x, y;
} ponto;
typedef struct {
  ponto a, b;
} retangulo;
retangulo vet[140000];
queue<retangulo> fila;
int flag = 1;
retangulo uniao(retangulo r1, retangulo r2) {
  flag = 1;
  if (r1.a.x > r2.b.x || r1.a.y > r2.b.y || r2.a.x > r1.b.x ||
      r2.a.y > r1.b.y) {
    flag = 0;
    return r1;
  }
  retangulo ret;
  if (r1.a.x >= r2.a.x)
    ret.a.x = r1.a.x;
  else
    ret.a.x = r2.a.x;
  if (r1.a.y >= r2.a.y)
    ret.a.y = r1.a.y;
  else
    ret.a.y = r2.a.y;
  if (r1.b.y <= r2.b.y)
    ret.b.y = r1.b.y;
  else
    ret.b.y = r2.b.y;
  if (r1.b.x <= r2.b.x)
    ret.b.x = r1.b.x;
  else
    ret.b.x = r2.b.x;
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", &vet[i].a.x, &vet[i].a.y, &vet[i].b.x, &vet[i].b.y);
    fila.push(vet[i]);
  }
  retangulo r1, r2, r3;
  while (42) {
    if (fila.size() < 2) break;
    r1 = fila.front();
    fila.pop();
    r2 = fila.front();
    fila.pop();
    r3 = uniao(r1, r2);
    if (flag == 0) {
      if (fila.empty()) {
        fila.push(r1);
        fila.push(r2);
        break;
      }
      fila.push(r1);
      fila.push(r2);
    } else
      fila.push(r3);
  }
  if (fila.size() == 1) {
    r1 = fila.front();
    printf("%d %d\n", r1.a.x, r1.a.y);
  } else if (fila.size() == 2) {
    r1 = fila.front();
    fila.pop();
    r2 = fila.front();
    int cont = 0;
    for (int i = 0; i < n; i++) {
      r3 = uniao(r1, vet[i]);
      if (flag == 1) {
        cont++;
        r1 = r3;
      }
    }
    if (cont >= n - 1) {
      printf("%d %d\n", r1.a.x, r1.a.y);
      return 0;
    }
    cont = 0;
    for (int i = 0; i < n; i++) {
      r3 = uniao(r2, vet[i]);
      if (flag == 1) {
        cont++;
        r2 = r3;
      }
    }
    if (cont >= n - 1) {
      printf("%d %d\n", r2.a.x, r2.a.y);
      return 0;
    }
  } else
    printf("%d %d\n", r1.a.x, r1.a.y);
  return 0;
}
