#include <bits/stdc++.h>
using namespace std;
int n, p[5], x, y;
int rect[132674][4];
int f[132674][5] = {};
int s[132674][5] = {};
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    scanf("%d %d %d %d", &rect[i][0], &rect[i][1], &rect[i][2], &rect[i][3]);
  f[0][0] = rect[0][0], f[0][1] = rect[0][1], f[0][2] = rect[0][2],
  f[0][3] = rect[0][3], f[0][4] = 1;
  for (int i = 1; i < n - 1; i++) {
    if (f[i - 1][4] && rect[i][0] <= f[i - 1][2] && rect[i][1] <= f[i - 1][3] &&
        rect[i][2] >= f[i - 1][0] && rect[i][3] >= f[i - 1][1]) {
      f[i][0] = max(rect[i][0], f[i - 1][0]);
      f[i][1] = max(rect[i][1], f[i - 1][1]);
      f[i][2] = min(rect[i][2], f[i - 1][2]);
      f[i][3] = min(rect[i][3], f[i - 1][3]);
      f[i][4] = 1;
    }
  }
  s[0][0] = rect[n - 1][0], s[0][1] = rect[n - 1][1], s[0][2] = rect[n - 1][2],
  s[0][3] = rect[n - 1][3], s[0][4] = 1;
  for (int i = n - 2; i > 0; i--) {
    int j = (n - 2) - i;
    if (s[j][4] && rect[i][0] <= s[j][2] && rect[i][1] <= s[j][3] &&
        rect[i][2] >= s[j][0] && rect[i][3] >= s[j][1]) {
      s[j + 1][0] = max(rect[i][0], s[j][0]);
      s[j + 1][1] = max(rect[i][1], s[j][1]);
      s[j + 1][2] = min(rect[i][2], s[j][2]);
      s[j + 1][3] = min(rect[i][3], s[j][3]);
      s[j + 1][4] = 1;
    }
  }
  if (f[n - 2][4])
    x = f[n - 2][2], y = f[n - 2][3];
  else if (s[n - 2][4])
    x = s[n - 2][0], y = s[n - 2][1];
  else {
    for (int i = 0; i < n - 2; i++) {
      int j = (n - 3) - i;
      if (f[i][4] && s[j][4]) {
        if (f[i][0] <= s[j][2] && f[i][1] <= s[j][3] && f[i][2] >= s[j][0] &&
            f[i][3] >= s[j][1]) {
          x = max(f[i][0], s[j][0]);
          y = max(f[i][1], s[j][1]);
          break;
        }
      }
    }
  }
  printf("%d %d", x, y);
  return 0;
}
