#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& p) {
  in >> p.first >> p.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2>& p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (auto& i : v) {
    out << i << "\n";
  }
  return out;
}
const long long MOD = 10000000000000007;
const long long TEMP = 29;
vector<pair<pair<int, int>, pair<int, int> > > rect;
multiset<int> x1, x2, y3, y2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  rect.resize(n);
  for (int i = (0); i < (n); ++i) {
    cin >> rect[i].first.first >> rect[i].first.second >>
        rect[i].second.first >> rect[i].second.second;
    x1.insert(-rect[i].first.first);
    y3.insert(-rect[i].first.second);
    x2.insert(rect[i].second.first);
    y2.insert(rect[i].second.second);
  }
  for (int i = (0); i < (n); ++i) {
    x1.erase(x1.find(-rect[i].first.first));
    y3.erase(y3.find(-rect[i].first.second));
    x2.erase(x2.find(rect[i].second.first));
    y2.erase(y2.find(rect[i].second.second));
    int temp1 = -*x1.begin();
    int temp2 = -*y3.begin();
    int temp3 = *x2.begin();
    int temp4 = *y2.begin();
    if (temp1 <= temp3 && temp2 <= temp4) {
      cout << temp1 << " " << temp2;
      return 0;
    }
    x1.insert(-rect[i].first.first);
    y3.insert(-rect[i].first.second);
    x2.insert(rect[i].second.first);
    y2.insert(rect[i].second.second);
  }
  return 0;
}
