#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, pair<int, int> > all[142674];
pair<pair<int, int>, pair<int, int> > how1[142674];
pair<pair<int, int>, pair<int, int> > how2[142674];
pair<pair<int, int>, pair<int, int> > temp;
int main() {
  int N, i;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d %d %d %d", &all[i].first.first, &all[i].first.second,
          &all[i].second.first, &all[i].second.second);
  }
  for (i = 0; i < N; i++) {
    if (i == 0)
      how1[i] = all[i];
    else {
      how1[i].first.first = max(how1[i - 1].first.first, all[i].first.first);
      how1[i].first.second = max(how1[i - 1].first.second, all[i].first.second);
      how1[i].second.first = min(how1[i - 1].second.first, all[i].second.first);
      how1[i].second.second =
          min(how1[i - 1].second.second, all[i].second.second);
    }
  }
  for (i = 0; i < N; i++) {
    if (i == 0)
      how2[i] = all[N - i - 1];
    else {
      how2[i].first.first =
          max(how2[i - 1].first.first, all[N - i - 1].first.first);
      how2[i].first.second =
          max(how2[i - 1].first.second, all[N - i - 1].first.second);
      how2[i].second.first =
          min(how2[i - 1].second.first, all[N - i - 1].second.first);
      how2[i].second.second =
          min(how2[i - 1].second.second, all[N - i - 1].second.second);
    }
  }
  for (i = 0; i < N - 1; i++) {
    if (i == N - 2)
      temp = how1[i];
    else {
      temp.first.first = max(how2[N - i - 3].first.first, how1[i].first.first);
      temp.first.second =
          max(how2[N - i - 3].first.second, how1[i].first.second);
      temp.second.first =
          min(how2[N - i - 3].second.first, how1[i].second.first);
      temp.second.second =
          min(how2[N - i - 3].second.second, how1[i].second.second);
    }
    if (temp.first.first <= temp.second.first &&
        temp.first.second <= temp.second.second) {
      printf("%d %d\n", temp.second.first, temp.second.second);
      return 0;
    } else if (i == N - 2) {
      temp = how2[i];
      printf("%d %d\n", temp.second.first, temp.second.second);
      return 0;
    }
  }
  return 0;
}
