#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<long long, long long>, pair<long long, long long>>> v;
long long n, x, y, z, w;
priority_queue<long long, vector<long long>, less<long long>> l, b;
priority_queue<long long, vector<long long>, greater<long long>> t, r;
bool leftpop, bottompop, rightpop, toppop;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> z >> w;
    v.push_back(make_pair(make_pair(x, y), make_pair(z, w)));
    l.push(x);
    b.push(y);
    r.push(z);
    t.push(w);
  }
  for (int i = 0; i < n; i++) {
    leftpop = false, bottompop = false, rightpop = false, toppop = false;
    if (l.top() == v[i].first.first) {
      l.pop();
      leftpop = true;
    }
    if (b.top() == v[i].first.second) {
      b.pop();
      bottompop = true;
    }
    if (r.top() == v[i].second.first) {
      r.pop();
      rightpop = true;
    }
    if (t.top() == v[i].second.second) {
      t.pop();
      toppop = true;
    }
    if (l.top() <= r.top() && b.top() <= t.top()) {
      cout << l.top() << " " << b.top();
      break;
    }
    if (leftpop) l.push(v[i].first.first);
    if (bottompop) b.push(v[i].first.second);
    if (rightpop) r.push(v[i].second.first);
    if (toppop) t.push(v[i].second.second);
  }
  return 0;
}
