#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
struct Point {
  int x;
  int y;
};
struct Rectangle {
  int x1, x2, y1, y2;
};
bool doOverlap(Point l1, Point r1, Point l2, Point r2) {
  if (l1.x > r2.x || l2.x > r1.x) return false;
  if (l1.y > r2.y || l2.y > r1.y) return false;
  return true;
}
Rectangle cross(Rectangle l, Rectangle r) {
  Rectangle ans;
  ans.x1 = max(l.x1, r.x1);
  ans.x2 = min(l.x2, r.x2);
  ans.y1 = max(l.y1, r.y1);
  ans.y2 = min(l.y2, r.y2);
  return ans;
}
bool correct(Rectangle a) {
  if (a.x1 <= a.x2 && a.y1 <= a.y2) return true;
  return false;
}
void solve() {
  int n;
  cin >> n;
  vector<Rectangle> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
  }
  Rectangle res = a[0];
  for (int i = 0; i < n - 1; i++) {
    res = cross(res, a[i]);
  }
  if (correct(res)) {
    cout << res.x1 << " " << res.y1 << endl;
    return;
  }
  res = a[1];
  for (int i = 1; i < n; i++) {
    res = cross(a[i], res);
  }
  if (correct(res)) {
    cout << res.x1 << " " << res.y1 << endl;
    return;
  }
  vector<Rectangle> b(n);
  b[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    b[i] = cross(b[i + 1], a[i]);
  }
  res = a[0];
  for (int i = 0; i < n - 2; i++) {
    res = cross(res, a[i]);
    if (correct(cross(res, b[i + 2]))) {
      res = cross(res, b[i + 2]);
      cout << res.x1 << " " << res.y1 << endl;
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
