#include <bits/stdc++.h>
using namespace std;
const int N = 150000;
int n;
struct Rec {
  int x, y, X, Y;
} a[N], pre[N], suf[N];
Rec operator+(Rec a, Rec b) {
  Rec c;
  c.x = max(a.x, b.x);
  c.y = max(a.y, b.y);
  c.X = min(a.X, b.X);
  c.Y = min(a.Y, b.Y);
  return c;
}
inline int read() {
  int x = 0, f = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
void check(Rec a) {
  if (a.X < a.x || a.Y < a.y) return;
  printf("%d %d\n", a.x, a.y);
  exit(0);
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i].x = read();
    a[i].y = read();
    a[i].X = read();
    a[i].Y = read();
  }
  pre[1] = a[1];
  for (int i = 2; i <= n; i++) pre[i] = pre[i - 1] + a[i];
  suf[n] = a[n];
  for (int i = n - 1; i; i--) suf[i] = suf[i + 1] + a[i];
  for (int i = 1; i <= n; i++) {
    if (i == 1)
      check(suf[2]);
    else if (i == n)
      check(pre[n - 1]);
    else
      check(pre[i - 1] + suf[i + 1]);
  }
}
