#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
multiset<int> s[4];
int n, c[maxn][4];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 4; ++j) {
      scanf("%d", &c[i][j]);
      s[j].insert(c[i][j]);
    }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 4; ++j) s[j].erase(s[j].find(c[i][j]));
    if (*s[0].rbegin() <= *s[2].begin() && *s[1].rbegin() <= *s[3].begin())
      return printf("%d %d\n", *s[0].rbegin(), *s[1].rbegin()), 0;
    for (int j = 0; j < 4; ++j) s[j].insert(c[i][j]);
  }
  return 0;
}
