#include <bits/stdc++.h>
using namespace std;
const int N = (1 << 20);
int n;
pair<pair<int, int>, pair<int, int> > rec[N];
int l[N];
int r[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> rec[i].first.first >> rec[i].first.second >> rec[i].second.first >>
        rec[i].second.second;
    l[i] = rec[i].first.first;
    r[i] = rec[i].first.second;
  }
  sort(l, l + n);
  sort(r, r + n);
  for (int _i = n - 2; _i < n; ++_i) {
    for (int j = n - 2; j < n; ++j) {
      int first = l[_i];
      int second = r[j];
      int cur = 0;
      for (int i = 0; i < n; ++i) {
        int flag = 0;
        if ((rec[i].first.first <= first) && (first <= rec[i].second.first))
          flag++;
        if ((rec[i].first.second <= second) && (second <= rec[i].second.second))
          flag++;
        if (flag == 2) cur++;
      }
      if (cur >= n - 1) {
        cout << first << " " << second << endl;
        return 0;
      }
    }
  }
}
