#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int i, j, k, n, m, p, q, t, d = 0, x, y;
  cin >> n;
  int a[n][4], b[n][2], c[n][2];
  for (i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
  }
  for (i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      b[i][0] = a[i][0];
      b[i][1] = a[i][2];
    } else {
      b[i][0] = max(b[i + 1][0], a[i][0]);
      b[i][1] = min(b[i + 1][1], a[i][2]);
    }
  }
  for (i = n - 1; i >= 0; i--) {
    if (i == n - 1) {
      c[i][0] = a[i][1];
      c[i][1] = a[i][3];
    } else {
      c[i][0] = max(c[i + 1][0], a[i][1]);
      c[i][1] = min(c[i + 1][1], a[i][3]);
    }
  }
  int l1, r1, l2, r2;
  for (i = 0; i < n; i++) {
    if (i == 0) {
      if (b[i + 1][0] <= b[i + 1][1] && c[i + 1][0] <= c[i + 1][1]) {
        cout << b[i + 1][0] << " " << c[i + 1][0];
        exit(0);
      }
      l1 = a[i][0];
      r1 = a[i][2];
      l2 = a[i][1];
      r2 = a[i][3];
    } else if (i == n - 1) {
      if (l1 <= r1 && l2 <= r2) {
        cout << l1 << " " << l2;
        exit(0);
      }
    } else {
      int x1, y1, x2, y2;
      x1 = max(b[i + 1][0], l1);
      y1 = min(b[i + 1][1], r1);
      x2 = max(c[i + 1][0], l2);
      y2 = min(c[i + 1][1], r2);
      if (x1 <= y1 && x2 <= y2) {
        cout << x1 << " " << x2;
        exit(0);
      }
      l1 = max(a[i][0], l1);
      r1 = min(a[i][2], r1);
      l2 = max(a[i][1], l2);
      r2 = min(a[i][3], r2);
    }
  }
  return 0;
}
