#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline int chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline int chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const int MAXN = (1 << 20);
int n;
multiset<int> mn_x, mx_x, mn_y, mx_y;
pair<int, int> a[MAXN];
pair<int, int> b[MAXN];
void read() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> b[i].first >> a[i].second >> b[i].second;
    mn_x.insert(a[i].second);
    mx_x.insert(a[i].first);
    mn_y.insert(b[i].second);
    mx_y.insert(b[i].first);
  }
}
void solve() {
  for (int i = 0; i < n; i++) {
    mn_x.erase(mn_x.find(a[i].second));
    mx_x.erase(mx_x.find(a[i].first));
    mn_y.erase(mn_y.find(b[i].second));
    mx_y.erase(mx_y.find(b[i].first));
    int low_x = *prev(mx_x.end()), high_x = *mn_x.begin();
    int low_y = *prev(mx_y.end()), high_y = *mn_y.begin();
    if (low_x <= high_x && low_y <= high_y) {
      cout << low_x << " " << low_y << '\n';
      return;
    }
    mn_x.insert(a[i].second);
    mx_x.insert(a[i].first);
    mn_y.insert(b[i].second);
    mx_y.insert(b[i].first);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
