#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
inline long long bigmod(long long b, long long p, long long m) {
  long long ret = 1, cur = b % m;
  while (p) {
    if (p & 1) ret = (ret * cur) % m;
    cur = (cur * cur) % m;
    p = p >> 1;
  }
  return ret;
}
int shit[10000005];
int n;
int ara[200005][2], bra[200005][2];
multiset<int> lx, rx, ly, ry;
void rid(int i) {
  int xx1 = ara[i][0], yy1 = ara[i][1];
  int xx2 = bra[i][0], yy2 = bra[i][1];
  lx.erase(lx.find(xx1));
  ly.erase(ly.find(yy1));
  rx.erase(rx.find(xx2));
  ry.erase(ry.find(yy2));
}
void add(int i) {
  lx.insert(ara[i][0]);
  ly.insert(ara[i][1]);
  rx.insert(bra[i][0]);
  ry.insert(bra[i][1]);
}
void solve() {
  multiset<int>::iterator it;
  it = lx.end();
  it--;
  int xx1 = *it;
  it = rx.begin();
  int xx2 = *it;
  it = ly.end();
  it--;
  int yy1 = *it;
  it = ry.begin();
  int yy2 = *it;
  if (xx1 <= xx2 && yy1 <= yy2) {
    printf("%d %d\n", xx1, yy1);
    exit(0);
  }
}
void super_solve() {
  int i;
  for (i = 1; i <= n; i++) {
    rid(i);
    solve();
    add(i);
  }
  int oh = 10000000;
  while (oh--) {
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
    assert(false);
  }
}
int main() {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &ara[i][0], &ara[i][1]);
    scanf("%d %d", &bra[i][0], &bra[i][1]);
    add(i);
  }
  super_solve();
  return 0;
}
