#include <bits/stdc++.h>
using namespace std;
long long arr[166666][6];
multiset<long long> s[6];
signed main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= 4; j++) {
      scanf("%lld", &arr[i][j]);
      s[j].insert(arr[i][j]);
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= 4; j++) {
      s[j].erase(s[j].find(arr[i][j]));
    }
    if (*s[1].rbegin() <= *s[3].begin() && *s[2].rbegin() <= *s[4].begin()) {
      cout << *s[1].rbegin() << " " << *s[2].rbegin();
      return 0;
    }
    for (long long j = 1; j <= 4; j++) {
      s[j].insert(arr[i][j]);
    }
  }
  return 0;
}
