#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n;
  scanf("%d", &n);
  int arr[n], arry[n], arrx1[n], arry2[n], tmp1[n], tmp2[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i] >> arry[i] >> arrx1[i] >> arry2[i];
    tmp1[i] = arr[i];
    tmp2[i] = arry[i];
  }
  sort(tmp1, tmp1 + n);
  sort(tmp2, tmp2 + n);
  int first = tmp1[n - 1];
  int second = tmp2[n - 1];
  int cnt = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    if (first >= arr[i] && second >= arry[i] && first <= arrx1[i] &&
        second <= arry2[i])
      continue;
    else
      cnt++;
    if (cnt > 1) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << first << " " << second;
    return 0;
  }
  first = tmp1[n - 1];
  second = tmp2[n - 2];
  flag = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (first >= arr[i] && second >= arry[i] && first <= arrx1[i] &&
        second <= arry2[i])
      continue;
    else
      cnt++;
    if (cnt > 1) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << first << " " << second;
    return 0;
  }
  first = tmp1[n - 2];
  second = tmp2[n - 1];
  flag = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (first >= arr[i] && second >= arry[i] && first <= arrx1[i] &&
        second <= arry2[i])
      continue;
    else
      cnt++;
    if (cnt > 1) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << first << " " << second;
    return 0;
  }
  first = tmp1[n - 2];
  second = tmp2[n - 2];
  flag = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (first >= arr[i] && second >= arry[i] && first <= arrx1[i] &&
        second <= arry2[i])
      continue;
    else
      cnt++;
    if (cnt > 1) {
      flag = 1;
      break;
    }
  }
  cout << first << " " << second;
  return 0;
}
