#include <bits/stdc++.h>
using namespace std;
const long long N = 4e5;
vector<long long> coords;
vector<pair<pair<long long, bool>, pair<long long, long long> > > sweep;
map<long long, long long> ind;
struct nodo {
  int may, pos;
};
struct segTree {
  int n, h, d[N];
  nodo t[N << 1];
  void init() {
    h = sizeof(int) * 8 - __builtin_clz(n);
    for (long long i = 0; i < n; i++) t[i + n].pos = i;
  }
  void apply(int p, int v) {
    t[p].may = t[p].may + v;
    if (p < n) d[p] += v;
  }
  void push(int p) {
    for (int s = h; s > 0; s--) {
      int i = p >> s;
      if (d[i] != 0) {
        apply(i << 1, d[i]);
        apply(i << 1 | 1, d[i]);
        d[i] = 0;
      }
    }
  }
  void build(int p) {
    while (p > 1) {
      p >>= 1;
      if (t[p << 1].may > t[p << 1 | 1].may) {
        t[p].pos = t[p << 1].pos;
        t[p].may = t[p << 1].may + d[p];
      } else {
        t[p].may = t[p << 1 | 1].may + d[p];
        t[p].pos = t[p << 1 | 1].pos;
      }
    }
  }
  void upd(int l, int r, int v) {
    l += n, r += n;
    int l0 = l, r0 = r;
    push(l);
    push(r - 1);
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) apply(l++, v);
      if (r & 1) apply(--r, v);
    }
    build(l0);
    build(r0 - 1);
  }
  pair<long long, long long> que() {
    int l = 0, r = n;
    nodo ans;
    ans.may = -1;
    l += n, r += n;
    push(l);
    push(r - 1);
    for (; l < r; l >>= 1, r >>= 1) {
      if (l & 1) {
        if (t[l].may > ans.may) {
          ans = t[l];
        }
        l++;
      }
      if (r & 1) {
        if (t[r - 1].may > ans.may) {
          ans = t[r - 1];
        }
        r--;
      }
    }
    return make_pair(ans.may, ans.pos);
  }
} st;
int main() {
  int n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    sweep.push_back(make_pair(make_pair(x1, 0), make_pair(y1, y2)));
    sweep.push_back(make_pair(make_pair(x2, 1), make_pair(y1, y2)));
    coords.push_back(y1);
    coords.push_back(y2);
  }
  sort((sweep).begin(), (sweep).end());
  sort((coords).begin(), (coords).end());
  coords.resize(unique((coords).begin(), (coords).end()) - coords.begin());
  int i = 0;
  for (long long y : coords) ind[y] = i++;
  st.n = (coords).size();
  st.init();
  for (auto elem : sweep) {
    long long x = elem.first.first;
    long long y1 = elem.second.first;
    long long y2 = elem.second.second;
    bool t = elem.first.second;
    if (!t) {
      st.upd(ind[y1], ind[y2] + 1, +1);
      pair<long long, long long> cur = st.que();
      if (cur.first >= n - 1) {
        cout << x << " " << coords[cur.second] << endl;
        return 0;
      }
    } else {
      st.upd(ind[y1], ind[y2] + 1, -1);
    }
  }
  return 0;
}
