#include <bits/stdc++.h>
using namespace std;
template <typename T>
T getint() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') p = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * p;
}
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
template <typename T1, typename T2>
bool umin(T1 &x, const T2 &y) {
  if (x > y) return x = y, true;
  return false;
}
template <typename T1, typename T2>
bool umax(T1 &x, const T2 &y) {
  if (x < y) return x = y, true;
  return false;
}
const int maxn = (int)1e6 + 10;
const int inf = (int)1e9 + 5;
const int mod = 998244353;
const long long llinf = (long long)1e18 + 5;
const long double pi = acos(-1.0);
struct Rect {
  int x1, y1, x2, y2;
  bool empty() const { return x1 > x2 || y1 > y2; }
};
Rect inter(Rect a, Rect b) {
  Rect c;
  c.x1 = max(a.x1, b.x1);
  c.x2 = min(a.x2, b.x2);
  c.y1 = max(a.y1, b.y1);
  c.y2 = min(a.y2, b.y2);
  return c;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<Rect> rect(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> rect[i].x1 >> rect[i].y1 >> rect[i].x2 >> rect[i].y2;
  }
  vector<Rect> pref(n + 1), suff(n + 1);
  for (int i = 1; i <= n; ++i) {
    pref[i] = rect[i];
    if (i > 1) pref[i] = inter(rect[i], pref[i - 1]);
  }
  for (int i = n; i >= 1; --i) {
    suff[i] = rect[i];
    if (i < n) suff[i] = inter(rect[i], suff[i + 1]);
  }
  for (int i = 1; i <= n; ++i) {
    auto z = (i == 1 ? suff[i + 1] : pref[i - 1]);
    if (i + 1 <= n) z = inter(z, suff[i + 1]);
    if (z.empty()) continue;
    cout << z.x1 << ' ' << z.y1 << endl;
    return 0;
  }
  return 0;
}
