#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
struct rec {
  int x1, y1, x2, y2;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  vector<rec> v;
  int n;
  cin >> n;
  multiset<int> x1, x2, y1, y2;
  for (int i = 0; i < n; i++) {
    rec r;
    cin >> r.x1 >> r.y1 >> r.x2 >> r.y2;
    v.push_back(r);
    x1.insert(r.x1);
    x2.insert(r.x2);
    y1.insert(r.y1);
    y2.insert(r.y2);
  }
  for (auto i : v) {
    x1.erase(x1.find(i.x1));
    x2.erase(x2.find(i.x2));
    y1.erase(y1.find(i.y1));
    y2.erase(y2.find(i.y2));
    if (*x1.rbegin() <= *x2.begin() and *y1.rbegin() <= *y2.begin()) {
      cout << *x1.rbegin() << " " << *y1.rbegin() << '\n';
      return 0;
    }
    x1.insert(i.x1);
    x2.insert(i.x2);
    y1.insert(i.y1);
    y2.insert(i.y2);
  }
  return 0;
}
