#include <bits/stdc++.h>
using namespace std;
long long a[200000][5], n, x[200000], y[200000], xx1, xx2, yy1, yy2;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i][1] >> a[i][2] >> a[i][3] >> a[i][4];
    x[i] = a[i][1];
    y[i] = a[i][2];
  }
  sort(x + 1, x + n + 1);
  sort(y + 1, y + n + 1);
  reverse(x + 1, x + n + 1);
  reverse(y + 1, y + n + 1);
  xx1 = x[1];
  xx2 = x[2];
  yy1 = y[1];
  yy2 = y[2];
  int s = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i][1] <= xx1 && a[i][3] >= xx1 && a[i][2] <= yy1 && a[i][4] >= yy1)
      s++;
  }
  if (s >= n - 1) {
    cout << xx1 << " " << yy1;
    return 0;
  }
  s = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i][1] <= xx1 && a[i][3] >= xx1 && a[i][2] <= yy2 && a[i][4] >= yy2)
      s++;
  }
  if (s >= n - 1) {
    cout << xx1 << " " << yy2;
    return 0;
  }
  s = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i][1] <= xx2 && a[i][3] >= xx2 && a[i][2] <= yy1 && a[i][4] >= yy1)
      s++;
  }
  if (s >= n - 1) {
    cout << xx2 << " " << yy1;
    return 0;
  }
  s = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i][1] <= xx2 && a[i][3] >= xx2 && a[i][2] <= yy2 && a[i][4] >= yy2)
      s++;
  }
  if (s >= n - 1) {
    cout << xx2 << " " << yy2;
    return 0;
  }
  s = 0;
}
