#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x, y, p, q, r, s;
  cin >> n;
  long long int a[n], b[n], c[n], d[n], e[n], f[n], g[n], h[n];
  for (i = 0; i < n; i++) {
    cin >> a[i] >> c[i] >> b[i] >> d[i];
    e[i] = a[i];
    f[i] = b[i];
    g[i] = c[i];
    h[i] = d[i];
  }
  sort(a, a + n);
  sort(b, b + n);
  sort(c, c + n);
  sort(d, d + n);
  for (i = 0; i < n; i++) {
    p = a[n - 1];
    q = b[0];
    r = c[n - 1];
    s = d[0];
    if (e[i] == p) p = a[n - 2];
    if (f[i] == q) q = b[1];
    if (g[i] == r) r = c[n - 2];
    if (h[i] == s) s = d[1];
    if (p <= q && r <= s) {
      x = (p + q) / 2;
      y = (r + s) / 2;
      break;
    }
  }
  cout << x << " " << y;
  return 0;
}
