#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
vector<int> u, d, l, r;
multiset<int> su, sd, sl, sr;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    u.push_back(y2), d.push_back(y1), l.push_back(x1), r.push_back(x2);
    su.insert(y2), sd.insert(y1), sl.insert(x1), sr.insert(x2);
  }
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    su.erase(su.find(u[i]));
    sd.erase(sd.find(d[i]));
    sl.erase(sl.find(l[i]));
    sr.erase(sr.find(r[i]));
    if (*sl.rbegin() <= *sr.begin() && *sd.rbegin() <= *su.begin()) {
      cout << *sl.rbegin() << " " << *sd.rbegin() << endl;
      break;
    }
    su.insert(u[i]);
    sd.insert(d[i]);
    sl.insert(l[i]);
    sr.insert(r[i]);
  }
  return 0;
}
