#include <bits/stdc++.h>
using namespace std;
char _;
int num_rectangles;
pair<pair<int, int>, pair<int, int> > rectangles[135000], pre[135000],
    suff[135000];
pair<pair<int, int>, pair<int, int> > intersection(
    pair<pair<int, int>, pair<int, int> > first,
    pair<pair<int, int>, pair<int, int> > second) {
  if (first.first.first == INT_MIN || second.first.first == INT_MIN)
    return {{INT_MIN, INT_MIN}, {INT_MIN, INT_MIN}};
  int tx = max(first.first.first, second.first.first),
      bx = min(first.second.first, second.second.first);
  int ty = max(first.first.second, second.first.second),
      by = min(first.second.second, second.second.second);
  if (bx < tx || by < ty) return {{INT_MIN, INT_MIN}, {INT_MIN, INT_MIN}};
  return {{tx, ty}, {bx, by}};
}
int main() {
  scanf("%d", &num_rectangles);
  for (int i = 0; i < num_rectangles; i++)
    scanf(" %d %d %d %d", &rectangles[i].first.first,
          &rectangles[i].first.second, &rectangles[i].second.first,
          &rectangles[i].second.second);
  sort(rectangles, rectangles + num_rectangles);
  pre[0] = rectangles[0];
  suff[num_rectangles - 1] = rectangles[num_rectangles - 1];
  for (int i = 1; i < num_rectangles; i++) {
    pre[i] = intersection(pre[i - 1], rectangles[i]);
    suff[num_rectangles - i - 1] = intersection(
        suff[num_rectangles - i], rectangles[num_rectangles - i - 1]);
  }
  for (int i = 0; i < num_rectangles; i++) {
    if (i == 0) {
      if (suff[1].first.first != INT_MIN) {
        printf("%d %d\n", suff[1].first.first, suff[1].first.second);
        return 0;
      }
    } else if (i == num_rectangles - 1) {
      if (pre[num_rectangles - 2].first.first != INT_MIN) {
        printf("%d %d\n", pre[num_rectangles - 2].first.first,
               pre[num_rectangles - 2].first.second);
        return 0;
      }
    } else {
      pair<pair<int, int>, pair<int, int> > first = pre[i - 1],
                                            second = suff[i + 1],
                                            intersect =
                                                intersection(first, second);
      if (intersect.first.first != INT_MIN) {
        printf("%d %d\n", intersect.first.first, intersect.first.second);
        return 0;
      }
    }
  }
  if (pre[num_rectangles - 1].first.first != INT_MIN) {
    printf("%d %d\n", pre[num_rectangles - 1].first.first,
           pre[num_rectangles - 1].first.second);
    return 0;
  }
  printf("-1\n");
}
