#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long topX, topY;
  long long bottomX, bottomY;
};
Point Intersect(Point a, Point b) {
  Point temp;
  temp.topX = min(a.topX, b.topX);
  temp.topY = min(a.topY, b.topY);
  temp.bottomX = max(a.bottomX, b.bottomX);
  temp.bottomY = max(a.bottomY, b.bottomY);
  if (temp.bottomX > temp.topX || temp.bottomY > temp.topY) {
    temp.topX = -1e15;
  }
  return temp;
}
int main() {
  int n;
  scanf("%d", &n);
  Point Rectangle[n];
  for (int i = 0; i < n; i++) {
    scanf("%lld", &Rectangle[i].bottomX);
    scanf("%lld", &Rectangle[i].bottomY);
    scanf("%lld", &Rectangle[i].topX);
    scanf("%lld", &Rectangle[i].topY);
  }
  Point intersectionsPre[n + 1], intersectionsPost[n + 1];
  intersectionsPre[0].topX = INT_MAX;
  intersectionsPre[0].topY = INT_MAX;
  intersectionsPre[0].bottomX = INT_MIN;
  intersectionsPre[0].bottomY = INT_MIN;
  intersectionsPost[n].topX = INT_MAX;
  intersectionsPost[n].topY = INT_MAX;
  intersectionsPost[n].bottomX = INT_MIN;
  intersectionsPost[n].bottomY = INT_MIN;
  for (int i = 1; i <= n; i++) {
    intersectionsPre[i] = Intersect(intersectionsPre[i - 1], Rectangle[i - 1]);
  }
  for (int i = n - 1; i >= 0; i--) {
    intersectionsPost[i] = Intersect(intersectionsPost[i + 1], Rectangle[i]);
  }
  bool f = 0;
  for (int i = 0; i < n; i++) {
    if (intersectionsPre[i].topX != -1e15) {
      Point temp = Intersect(intersectionsPre[i], intersectionsPost[i + 1]);
      if (temp.topX != -1e15) {
        cout << temp.topX << ' ' << temp.topY << endl;
        f = 1;
        break;
      }
    }
    if (f) break;
  }
  return 0;
}
