#include <bits/stdc++.h>
using namespace std;
const int N = 155555;
int a[N][4], n;
multiset<int> s[4];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 4; j++) cin >> a[i][j], s[j].insert(a[i][j]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) s[j].erase(s[j].find(a[i][j]));
    if (*s[0].rbegin() <= *s[2].begin() && *s[1].rbegin() <= *s[3].begin()) {
      cout << *s[0].rbegin() << " " << *s[1].rbegin() << endl;
      break;
    }
    for (int j = 0; j < 4; j++) s[j].insert(a[i][j]);
  }
}
