#include <bits/stdc++.h>
using namespace std;
long long int x1[153000];
long long int y11[153000];
long long int x2[153000];
long long int y2[153000];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  long long int n;
  cin >> n;
  multiset<long long int> stx1;
  multiset<long long int> stx2;
  multiset<long long int> sty11;
  multiset<long long int> sty2;
  for (long long int i = 0; i < n; i++) {
    cin >> x1[i] >> y11[i] >> x2[i] >> y2[i];
    stx1.insert(x1[i]);
    stx2.insert(x2[i]);
    sty11.insert(y11[i]);
    sty2.insert(y2[i]);
  }
  for (long long int i = 0; i < n; i++) {
    auto it1 = stx1.find(x1[i]);
    auto it2 = stx2.find(x2[i]);
    auto it3 = sty11.find(y11[i]);
    auto it4 = sty2.find(y2[i]);
    long long int mx1 = *stx1.rbegin();
    long long int mx2 = *stx2.begin();
    long long int my11 = *sty11.rbegin();
    long long int my2 = *sty2.begin();
    if (mx1 <= mx2 && my11 <= my2) {
      cout << mx1 << " " << my11 << "\n";
      break;
    }
    stx1.erase(it1);
    stx2.erase(it2);
    sty11.erase(it3);
    sty2.erase(it4);
    mx1 = *stx1.rbegin();
    mx2 = *stx2.begin();
    my11 = *sty11.rbegin();
    my2 = *sty2.begin();
    if (mx1 <= mx2 && my11 <= my2) {
      cout << mx1 << " " << my11 << "\n";
      break;
    }
    stx1.insert(x1[i]);
    stx2.insert(x2[i]);
    sty11.insert(y11[i]);
    sty2.insert(y2[i]);
  }
  return 0;
}
