#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 10;
const int inf = 1e9 + 10;
const int N = 1e6 + 10;
struct osu {
  int x, y, x1, theboatman;
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<osu> v(n);
  vector<pair<pair<int, int>, pair<int, int> > > v1(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].x >> v[i].y >> v[i].x1 >> v[i].theboatman;
    v1[i].first.first = v[i].x;
    v1[i].first.second = v[i].y;
    v1[i].second.first = v[i].x1;
    v1[i].second.second = v[i].theboatman;
  }
  int x = -inf, y = -inf, x1 = inf, theboatman = inf;
  int qx = -inf, qy = -inf, qx1 = inf, qy1 = inf;
  sort(v1.begin(), v1.end());
  for (int i = 0; i < n; i++) {
    if (v[i].x > x) {
      qx = x;
      x = v[i].x;
    } else
      qx = max(qx, v[i].x);
    if (v[i].y > y) {
      qy = y;
      y = v[i].y;
    } else
      qy = max(qy, v[i].y);
    if (v[i].x1 < x1) {
      qx1 = x1;
      x1 = v[i].x1;
    } else
      qx1 = min(qx1, v[i].x1);
    if (v[i].theboatman < theboatman) {
      qy1 = theboatman;
      theboatman = v[i].theboatman;
    } else
      qy1 = min(qy1, v[i].theboatman);
  }
  if (x <= x1 and y <= theboatman) return cout << x << " " << y << "\n", 0;
  for (int i = 0; i < n; i++) {
    int X, Y, X1, Y1;
    if (v1[i].first.first != x)
      X = x;
    else
      X = qx;
    if (v1[i].first.second != y)
      Y = y;
    else
      Y = qy;
    if (v1[i].second.first != x1)
      X1 = x1;
    else
      X1 = qx1;
    if (v1[i].second.second != theboatman)
      Y1 = theboatman;
    else
      Y1 = qy1;
    if (X <= X1 and Y <= Y1) return cout << X << " " << Y << "\n", 0;
  }
  return 0;
}
