#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MAX = 2000;
struct Point {
  int x1, y1, x2, y2;
};
int GetMax(multiset<int> &s) { return *(--s.end()); }
int GetMin(multiset<int> &s) { return *(s.begin()); }
void Solve() {
  int n;
  scanf("%d", &n);
  vector<Point> v(n);
  multiset<int> x1, y1, x2, y2;
  for (int i = 0; i < n; ++i) {
    Point p;
    scanf("%d %d %d %d", &p.x1, &p.y1, &p.x2, &p.y2);
    v[i] = p;
    x1.insert(p.x1);
    y1.insert(p.y1);
    x2.insert(p.x2);
    y2.insert(p.y2);
  }
  for (int i = 0; i < n; ++i) {
    Point p = v[i];
    x1.erase(x1.find(p.x1));
    y1.erase(y1.find(p.y1));
    x2.erase(x2.find(p.x2));
    y2.erase(y2.find(p.y2));
    int max_x = GetMax(x1);
    int min_x = GetMin(x2);
    int max_y = GetMax(y1);
    int min_y = GetMin(y2);
    if (max_x <= min_x && max_y <= min_y) {
      cout << max_x << " " << max_y << endl;
      return;
    }
    x1.insert(p.x1);
    y1.insert(p.y1);
    x2.insert(p.x2);
    y2.insert(p.y2);
  }
}
int main() {
  Solve();
  return 0;
}
