#include <bits/stdc++.h>
using namespace std;
struct rec {
  int x1, y1, x2, y2;
} a[200000];
vector<int> x, y;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    a[i] = {x1, y1, x2, y2};
    x.push_back(x1);
    x.push_back(x2);
    y.push_back(y1);
    y.push_back(y2);
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  for (int i = -1; i < 1; i++)
    for (int j = -1; j < 1; j++) {
      int cnt = 0;
      int ansx = x[x.size() / 2 + i];
      int ansy = y[y.size() / 2 + j];
      for (int t = 0; t < n; t++)
        if (a[t].x1 <= ansx && ansx <= a[t].x2 && a[t].y1 <= ansy &&
            ansy <= a[t].y2)
          cnt++;
      if (cnt >= n - 1) {
        printf("%d %d\n", ansx, ansy);
        return 0;
      }
    }
}
