#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  std::vector<long long> x0, x1, y0, y1;
  long long a[n][4];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
    x0.push_back(a[i][0]);
    x1.push_back(a[i][2] + 1);
    y0.push_back(a[i][1]);
    y1.push_back(a[i][3] + 1);
  }
  sort((x0).begin(), (x0).end());
  sort((x1).begin(), (x1).end());
  sort((y0).begin(), (y0).end());
  sort((y1).begin(), (y1).end());
  long long lx = x0[n - 1];
  long long ly = y0[n - 1];
  long long ux = x1[0];
  long long uy = y1[0];
  for (long long int i = 0; i < n; i++) {
    long long xi = a[i][0];
    long long xf = a[i][2] + 1;
    long long yi = a[i][1];
    long long yf = a[i][3] + 1;
    long long x00 = lx;
    long long x11 = ux;
    long long y00 = ly;
    long long y11 = uy;
    if (xi == lx) {
      x00 = x0[n - 2];
    }
    if (xf == ux) {
      x11 = x1[1];
    }
    if (yi == ly) {
      y00 = y0[n - 2];
    }
    if (yf == uy) {
      y11 = y1[1];
    }
    if (x00 < x11 && y00 < y11) {
      cout << x00 << " " << y00;
      return 0;
    }
  }
}
