#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  multiset<int> x1, y1, x2, y2;
  for (int i = 1; i <= n; i++) {
    int a1, b1, c, d;
    cin >> a1 >> b1 >> c >> d;
    x1.insert(a1);
    x2.insert(c);
    y1.insert(b1);
    y2.insert(d);
    a.push_back(make_pair(a1, b1));
    b.push_back(make_pair(c, d));
  }
  for (int i = 0; i < n; i++) {
    pair<int, int> a1 = a[i];
    pair<int, int> b1 = b[i];
    x1.erase(x1.find(a1.first));
    x2.erase(x2.find(b1.first));
    y1.erase(y1.find(a1.second));
    y2.erase(y2.find(b1.second));
    int sol_x1 = *x1.rbegin(), sol_x2 = *x2.begin(), sol_y1 = *y1.rbegin(),
        sol_y2 = *y2.begin();
    if (sol_x1 <= sol_x2 && sol_y1 <= sol_y2) {
      cout << sol_x1 << " " << sol_y1;
      return 0;
    }
    x1.insert(a1.first);
    x2.insert(b1.first);
    y1.insert(a1.second);
    y2.insert(b1.second);
  }
}
