#include <bits/stdc++.h>
using namespace std;
int X1[555555][3], Y1[555555][3], X2[555555][3], Y2[555555][3];
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d%d", &X1[i][0], &Y1[i][0], &X2[i][0], &Y2[i][0]);
  X1[0][1] = -2e9;
  Y1[0][1] = -2e9;
  X2[0][1] = 2e9;
  Y2[0][1] = 2e9;
  X1[n + 1][2] = -2e9;
  Y1[n + 1][2] = -2e9;
  X2[n + 1][2] = 2e9;
  Y2[n + 1][2] = 2e9;
  for (int i = 1; i <= n; i++) {
    X1[i][1] = max(X1[i][0], X1[i - 1][1]);
    Y1[i][1] = max(Y1[i][0], Y1[i - 1][1]);
    X2[i][1] = min(X2[i][0], X2[i - 1][1]);
    Y2[i][1] = min(Y2[i][0], Y2[i - 1][1]);
  }
  for (int i = n; i >= 1; i--) {
    X1[i][2] = max(X1[i][0], X1[i + 1][2]);
    Y1[i][2] = max(Y1[i][0], Y1[i + 1][2]);
    X2[i][2] = min(X2[i][0], X2[i + 1][2]);
    Y2[i][2] = min(Y2[i][0], Y2[i + 1][2]);
  }
  for (int i = 1; i <= n; i++) {
    int asfjaljsfkljsf = max(X1[i - 1][1], X1[i + 1][2]);
    int saikfasopfipsa = min(X2[i - 1][1], X2[i + 1][2]);
    int sjfkajflksajfj = max(Y1[i - 1][1], Y1[i + 1][2]);
    int sajflkajskfjs = min(Y2[i - 1][1], Y2[i + 1][2]);
    if (asfjaljsfkljsf <= saikfasopfipsa && sjfkajflksajfj <= sajflkajskfjs) {
      printf("%d %d\n", asfjaljsfkljsf, sjfkajflksajfj);
      return 0;
    }
  }
  return 0;
}
