#include <bits/stdc++.h>
using namespace std;
const long long int inf = 0x3f3f3f3f;
const long long int mod = 1e9 + 7;
const long long int N = 1e6 + 6;
long long int a[N][4], n;
long long int L[N][4], R[N][4];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = 0; j < 4; j++) cin >> a[i][j];
  }
  long long int x1, y1, x2, y2, x3, y3, x4, y4;
  L[0][0] = -inf;
  L[0][1] = -inf;
  L[0][2] = inf;
  L[0][3] = inf;
  for (long long int i = 1; i <= n; i++) {
    x1 = a[i][0];
    y1 = a[i][1];
    x2 = a[i][2];
    y2 = a[i][3];
    x3 = L[i - 1][0];
    y3 = L[i - 1][1];
    x4 = L[i - 1][2];
    y4 = L[i - 1][3];
    L[i][0] = max(x1, x3);
    L[i][1] = max(y1, y3);
    L[i][2] = min(x2, x4);
    L[i][3] = min(y2, y4);
  }
  R[n + 1][0] = -inf;
  R[n + 1][1] = -inf;
  R[n + 1][2] = inf;
  R[n + 1][3] = inf;
  for (long long int i = n; i >= 1; i--) {
    x1 = a[i][0];
    y1 = a[i][1];
    x2 = a[i][2];
    y2 = a[i][3];
    x3 = R[i + 1][0];
    y3 = R[i + 1][1];
    x4 = R[i + 1][2];
    y4 = R[i + 1][3];
    R[i][0] = max(x1, x3);
    R[i][1] = max(y1, y3);
    R[i][2] = min(x2, x4);
    R[i][3] = min(y2, y4);
  }
  for (long long int i = 1; i <= n; i++) {
    x1 = L[i - 1][0];
    y1 = L[i - 1][1];
    x2 = L[i - 1][2];
    y2 = L[i - 1][3];
    x3 = R[i + 1][0];
    y3 = R[i + 1][1];
    x4 = R[i + 1][2];
    y4 = R[i + 1][3];
    long long int x5, y5, x6, y6;
    x5 = max(x1, x3);
    y5 = max(y1, y3);
    x6 = min(x2, x4);
    y6 = min(y2, y4);
    if (x5 <= x6 and y5 <= y6) {
      cout << x5 << " " << y5 << endl;
      break;
    }
  }
  return 0;
}
