#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> arr(n, vector<int>(4));
  for (int i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2] >> arr[i][3];
  }
  vector<vector<int>> arr_l(n + 1, vector<int>(4));
  vector<vector<int>> arr_r(n + 1, vector<int>(4));
  vector<int> temp(4);
  temp[0] = -1000000000;
  temp[1] = -1000000000;
  temp[2] = 1000000000;
  temp[3] = 1000000000;
  arr_l[0] = temp;
  arr_r[n] = temp;
  arr_l[1] = arr[0];
  for (int i = 2; i <= n; i++) {
    arr_l[i][0] = max(arr_l[i - 1][0], arr[i - 1][0]);
    arr_l[i][1] = max(arr_l[i - 1][1], arr[i - 1][1]);
    arr_l[i][2] = min(arr_l[i - 1][2], arr[i - 1][2]);
    arr_l[i][3] = min(arr_l[i - 1][3], arr[i - 1][3]);
  }
  arr_r[n - 1] = arr[n - 1];
  for (int i = n - 1; i >= 0; i--) {
    arr_r[i][0] = max(arr_r[i + 1][0], arr[i][0]);
    arr_r[i][1] = max(arr_r[i + 1][1], arr[i][1]);
    arr_r[i][2] = min(arr_r[i + 1][2], arr[i][2]);
    arr_r[i][3] = min(arr_r[i + 1][3], arr[i][3]);
  }
  int a1, b1, a2, b2;
  for (int i = 0; i < n; i++) {
    a1 = max(arr_l[i][0], arr_r[i + 1][0]);
    b1 = max(arr_l[i][1], arr_r[i + 1][1]);
    a2 = min(arr_l[i][2], arr_r[i + 1][2]);
    b2 = min(arr_l[i][3], arr_r[i + 1][3]);
    if (a1 <= a2 && b1 <= b2) {
      cout << a1 << " " << b1 << endl;
      return 0;
    }
  }
  return 0;
}
