#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > a(n, vector<int>(4)), prf(n, vector<int>(4)),
      suf(n, vector<int>(4));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 4; j++) cin >> a[i][j];
  for (int i = 0; i < 4; i++) prf[0][i] = a[0][i], suf[n - 1][i] = a[n - 1][i];
  for (int i = 1; i < n; i++)
    prf[i][0] = max(prf[i - 1][0], a[i][0]),
    prf[i][1] = max(prf[i - 1][1], a[i][1]),
    prf[i][2] = min(prf[i - 1][2], a[i][2]),
    prf[i][3] = min(prf[i - 1][3], a[i][3]);
  for (int i = n - 2; i >= 0; i--)
    suf[i][0] = max(suf[i + 1][0], a[i][0]),
    suf[i][1] = max(suf[i + 1][1], a[i][1]),
    suf[i][2] = min(suf[i + 1][2], a[i][2]),
    suf[i][3] = min(suf[i + 1][3], a[i][3]);
  if (prf[n - 2][0] <= prf[n - 2][2] && prf[n - 2][1] <= prf[n - 2][3])
    return cout << prf[n - 2][0] << " " << prf[n - 2][1], 0;
  if (suf[1][0] <= suf[1][2] && suf[1][1] <= suf[1][3])
    return cout << suf[1][0] << " " << suf[1][1], 0;
  for (int i = 1; i < n - 1; i++) {
    if (max(prf[i - 1][0], suf[i + 1][0]) <=
            min(prf[i - 1][2], suf[i + 1][2]) &&
        max(prf[i - 1][1], suf[i + 1][1]) <= min(prf[i - 1][3], suf[i + 1][3]))
      return cout << max(prf[i - 1][0], suf[i + 1][0]) << " "
                  << max(prf[i - 1][1], suf[i + 1][1]),
             0;
  }
}
