#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
};
pair<int, int> intersection(int x1, int x2, int x_l, int x_r) {
  vector<pair<int, int> > x, y;
  x.push_back({x1, -1});
  x.push_back({x2, 1});
  x.push_back({x_l, -1});
  x.push_back({x_r, 1});
  sort(x.begin(), x.end());
  int common_x_l = INT_MIN, common_x_r = INT_MIN;
  int open = 0;
  for (int ii = 0; ii < 4; ii++) {
    if (open == 2) {
      common_x_r = x[ii].first;
      break;
    }
    open = open + x[ii].second * -1;
    if (open == 2) {
      common_x_l = x[ii].first;
    }
  }
  return {common_x_l, common_x_r};
}
bool check(int x1, int x2, int y1, int y2) {
  if (x1 == INT_MIN or x2 == INT_MIN or y1 == INT_MIN or y2 == INT_MIN)
    return false;
  return true;
}
int main() {
  int x1, x2, x_l, x_r, y1, y2, y_l, y_r;
  int n;
  cin >> n;
  pair<pair<int, int>, pair<int, int> > pre[n];
  pair<pair<int, int>, pair<int, int> > suf[n];
  pair<pair<int, int>, pair<int, int> > sq[n];
  for (int i = 0; i < n; i++) {
    cin >> sq[i].first.first >> sq[i].second.first >> sq[i].first.second >>
        sq[i].second.second;
  }
  pre[0] = sq[0];
  for (int i = 1; i < n; i++) {
    x1 = pre[i - 1].first.first;
    x2 = pre[i - 1].first.second;
    x_l = sq[i].first.first;
    x_r = sq[i].first.second;
    pre[i].first = intersection(x1, x2, x_l, x_r);
    y1 = pre[i - 1].second.first;
    y2 = pre[i - 1].second.second;
    y_l = sq[i].second.first;
    y_r = sq[i].second.second;
    pre[i].second = intersection(y1, y2, y_l, y_r);
  }
  suf[n - 1] = sq[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    x1 = suf[i + 1].first.first;
    x2 = suf[i + 1].first.second;
    x_l = sq[i].first.first;
    x_r = sq[i].first.second;
    suf[i].first = intersection(x1, x2, x_l, x_r);
    y1 = suf[i + 1].second.first;
    y2 = suf[i + 1].second.second;
    y_l = sq[i].second.first;
    y_r = sq[i].second.second;
    suf[i].second = intersection(y1, y2, y_l, y_r);
  }
  for (int i = 0; i < n; i++) {
    if (i > 0 and i < n - 1) {
      if (check(pre[i - 1].first.first, pre[i - 1].first.second,
                pre[i - 1].second.first, pre[i - 1].second.second))
        if (check(suf[i + 1].first.first, suf[i + 1].first.second,
                  suf[i + 1].second.first, suf[i + 1].second.second)) {
          pair<int, int> t =
              intersection(pre[i - 1].first.first, pre[i - 1].first.second,
                           suf[i + 1].first.first, suf[i + 1].first.second);
          pair<int, int> q =
              intersection(pre[i - 1].second.first, pre[i - 1].second.second,
                           suf[i + 1].second.first, suf[i + 1].second.second);
          if (check(t.first, t.second, q.first, q.second)) {
            cout << t.first << " " << q.first;
            return 0;
          }
        }
    }
    if (i == 0) {
      if (check(suf[i + 1].first.first, suf[i + 1].first.second,
                suf[i + 1].second.first, suf[i + 1].second.second)) {
        cout << suf[i + 1].first.first << " " << suf[i + 1].second.first;
        return 0;
      }
    }
    if (i == n - 1) {
      if (check(pre[i - 1].first.first, pre[i - 1].first.second,
                pre[i - 1].second.first, pre[i - 1].second.second)) {
        cout << pre[i - 1].first.first << " " << pre[i - 1].second.first;
        return 0;
      }
    }
  }
}
