#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sign = 1;
  long long x = 0;
  char ch;
  while (!isdigit(ch = getchar()))
    if (ch == '-') sign = -1;
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * sign;
}
inline void wonl() { putchar('\n'); }
inline void wws() { putchar(' '); }
inline void dbg() { cout << endl; }
inline void ww(long long k) {
  if (k < 0) putchar('-'), k *= -1;
  char ch[20];
  int num = 0;
  while (k) ch[++num] = k % 10, k /= 10;
  if (num == 0) ch[++num] = 0;
  while (num) putchar(ch[num--] + '0');
}
const int N = 1e5 + 4;
template <typename T, typename... V>
inline void wonl(T t, V... v) {
  ww(t);
  if (sizeof...(v)) putchar(' ');
  wonl(v...);
}
template <typename T, typename... V>
inline void wws(T t, V... v) {
  ww(t);
  if (sizeof...(v)) putchar(' ');
  wws(v...);
}
template <typename T, typename... V>
inline void dbg(T t, V... v) {
  cout << ' ' << t;
  dbg(v...);
}
pair<pair<int, int>, pair<int, int>> fun(
    pair<pair<int, int>, pair<int, int>> fir,
    pair<pair<int, int>, pair<int, int>> sec) {}
void solve() {
  int n = read();
  vector<pair<pair<int, int>, pair<int, int>>> v(n), pa(n), su(n);
  for (int i = 0; i < n; i++)
    v[i].first.first = read(), v[i].first.second = read(),
    v[i].second.first = read(), v[i].second.second = read();
  pa[0] = v[0];
  for (int i = 1; i < n; i++) {
    pa[i].first.first = max(pa[i - 1].first.first, v[i].first.first);
    pa[i].first.second = max(pa[i - 1].first.second, v[i].first.second);
    pa[i].second.first = min(pa[i - 1].second.first, v[i].second.first);
    pa[i].second.second = min(pa[i - 1].second.second, v[i].second.second);
  }
  su[n - 1] = v[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    su[i].first.first = max(su[i + 1].first.first, v[i].first.first);
    su[i].first.second = max(su[i + 1].first.second, v[i].first.second);
    su[i].second.first = min(su[i + 1].second.first, v[i].second.first);
    su[i].second.second = min(su[i + 1].second.second, v[i].second.second);
  }
  pair<pair<int, int>, pair<int, int>> ch;
  if (su[1].second.second >= su[1].first.second &&
      su[1].second.first >= su[1].first.first) {
    wonl(su[1].first.first, su[1].first.second);
    return;
  }
  if (pa[n - 2].second.second >= pa[n - 2].first.second &&
      pa[n - 2].second.first >= pa[n - 2].first.first) {
    wonl(pa[n - 2].first.first, pa[n - 2].first.second);
    return;
  }
  for (int i = 1; i < n - 1; i++) {
    ch.first.first = max(su[i + 1].first.first, pa[i - 1].first.first);
    ch.first.second = max(su[i + 1].first.second, pa[i - 1].first.second);
    ch.second.first = min(su[i + 1].second.first, pa[i - 1].second.first);
    ch.second.second = min(su[i + 1].second.second, pa[i - 1].second.second);
    if (ch.second.second >= ch.first.second &&
        ch.second.first >= ch.first.first) {
      wonl(ch.first.first, ch.first.second);
      return;
    }
  }
}
int main() {
  solve();
  return 0;
}
