#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k;
  int N;
  cin >> N;
  vector<int> X1(N), Y1(N), X2(N), Y2(N);
  vector<pair<int, int>> xs, ys;
  set<int> xcand, ycand;
  for (i = 0; i < N; i++) {
    scanf("%d %d %d %d", &X1[i], &Y1[i], &X2[i], &Y2[i]);
    xs.push_back({X1[i], -1});
    xs.push_back({X2[i], 1});
    ys.push_back({Y1[i], -1});
    ys.push_back({Y2[i], 1});
  }
  sort(xs.begin(), xs.end());
  sort(ys.begin(), ys.end());
  int x = 0;
  for (auto p : xs) {
    if (max(x, x - p.second) >= N - 1) xcand.insert(p.first);
    x -= p.second;
  }
  int y = 0;
  for (auto p : ys) {
    if (max(y, y - p.second) >= N - 1) ycand.insert(p.first);
    y -= p.second;
  }
  for (auto x : xcand) {
    for (auto y : ycand) {
      int sum = 0;
      for (i = 0; i < N; i++) {
        if (X1[i] <= x && x <= X2[i] && Y1[i] <= y && y <= Y2[i]) sum++;
        if (sum >= N - 1) {
          cout << x << " " << y << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
