#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void PLAY() {
  cout << fixed << setprecision(15);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MAX = 1e6;
pair<int, int> bottom_left[MAX], upper_right[MAX];
pair<int, int> a[MAX], b[MAX], c[MAX], d[MAX];
int main() {
  PLAY();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> bottom_left[i].first >> bottom_left[i].second;
    cin >> upper_right[i].first >> upper_right[i].second;
  }
  a[0].first = a[0].second = c[n + 1].first = c[n + 1].second = INT_MIN;
  b[0].first = b[0].second = d[n + 1].first = d[n + 1].second = INT_MAX;
  for (int i = n; i >= 1; i--) {
    c[i].first = max(c[i + 1].first, bottom_left[i].first);
    c[i].second = max(c[i + 1].second, bottom_left[i].second);
    d[i].first = min(d[i + 1].first, upper_right[i].first);
    d[i].second = min(d[i + 1].second, upper_right[i].second);
  }
  for (int i = 1; i <= n; i++) {
    a[i].first = max(a[i - 1].first, bottom_left[i].first);
    a[i].second = max(a[i - 1].second, bottom_left[i].second);
    b[i].first = min(b[i - 1].first, upper_right[i].first);
    b[i].second = min(b[i - 1].second, upper_right[i].second);
  }
  for (int i = 1; i <= n; i++) {
    if (max(a[i - 1].first, c[i + 1].first) <=
            min(b[i - 1].first, d[i + 1].first) &&
        max(a[i - 1].second, c[i + 1].second) <=
            min(b[i - 1].second, d[i + 1].second)) {
      cout << max(a[i - 1].first, c[i + 1].first) << " "
           << max(a[i - 1].second, c[i + 1].second) << '\n';
      break;
    }
  }
  return 0;
}
