#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> seg;
vector<pair<int, int>> seg2;
map<int, int> m;
map<int, int> m2;
map<int, int> m3;
map<int, int> m4;
int main() {
  int n;
  scanf("%d", &n);
  pair<map<int, int>::iterator, bool> ret;
  for (int i = 0; i < n; i++) {
    int a, b, c, d;
    scanf("%d %d", &a, &b);
    scanf("%d %d", &c, &d);
    seg.push_back(make_pair(a, b));
    seg2.push_back(make_pair(c, d));
    ret = m.insert(make_pair(a, 1));
    if (ret.second == false) {
      m[a]++;
    }
    ret = m2.insert(make_pair(b, 1));
    if (ret.second == false) {
      m2[b]++;
    }
    ret = m3.insert(make_pair(c, 1));
    if (ret.second == false) {
      m3[c]++;
    }
    ret = m4.insert(make_pair(d, 1));
    if (ret.second == false) {
      m4[d]++;
    }
  }
  map<int, int>::iterator iter = --m.end();
  int mla = iter->first;
  map<int, int>::iterator iter2 = --m2.end();
  int mlb = iter2->first;
  map<int, int>::iterator iter3 = m3.begin();
  int mlc = iter3->first;
  map<int, int>::iterator iter4 = m4.begin();
  int mld = iter4->first;
  if (mla <= mlc && mlb <= mld) {
    printf("%d %d", mla, mlb);
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int ta = seg[i].first;
    int tb = seg[i].second;
    int tc = seg2[i].first;
    int td = seg2[i].second;
    bool ckab = false;
    bool ckcd = false;
    int xxx;
    int yyy;
    m[ta]--;
    m3[tc]--;
    map<int, int>::iterator iter3 = --m.end();
    int ttta = iter3->first;
    if (m[ttta] == 0) {
      iter3--;
      ttta = iter3->first;
    }
    map<int, int>::iterator iter4 = m3.begin();
    int tttb = iter4->first;
    if (m3[tttb] == 0) {
      iter4++;
      tttb = iter4->first;
    }
    if (ttta <= tttb) {
      ckab = true;
      xxx = ttta;
    }
    m2[tb]--;
    m4[td]--;
    map<int, int>::iterator iter5 = --m2.end();
    int tttc = iter5->first;
    if (m2[tttc] == 0) {
      iter5--;
      tttc = iter5->first;
    }
    map<int, int>::iterator iter6 = m4.begin();
    int tttd = iter6->first;
    if (m4[tttd] == 0) {
      iter6++;
      tttd = iter6->first;
    }
    if (tttc <= tttd) {
      ckcd = true;
      yyy = tttc;
    }
    m2[tb]++;
    m4[td]++;
    m[ta]++;
    m3[tc]++;
    if (ckab == true && ckcd == true) {
      printf("%d %d\n", xxx, yyy);
      return 0;
    }
  }
  return 0;
}
