#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j;
  cin >> n;
  long long l[n], r[n], t[n], b[n], l1[n], r1[n], t1[n], b1[n];
  for (i = 0; i < n; i++) {
    cin >> b[i] >> l[i] >> t[i] >> r[i];
    b1[i] = b[i];
    l1[i] = l[i];
    t1[i] = t[i];
    r1[i] = r[i];
  }
  sort(b1, b1 + n);
  sort(l1, l1 + n);
  sort(t1, t1 + n);
  sort(r1, r1 + n);
  for (i = 0; i < n; i++) {
    long long a, e, c, d;
    if (r1[0] == r[i])
      a = r1[1];
    else
      a = r1[0];
    if (l1[n - 1] == l[i])
      e = l1[n - 2];
    else
      e = l1[n - 1];
    if (t1[0] == t[i])
      c = t1[1];
    else
      c = t1[0];
    if (b1[n - 1] == b[i])
      d = b1[n - 2];
    else
      d = b1[n - 1];
    if (d <= c && e <= a) {
      cout << (c + d) / 2 << " " << (a + e) / 2 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
