#include <bits/stdc++.h>
using namespace std;
vector<int> v[1000005];
map<int, int> mp1, mp2;
set<int> s1, s2;
vector<int> v1, v2;
int n;
int a[132678][2], b[132678][2];
int cnt[132678 * 2], res[132678 * 2];
void solve1(map<int, int> mp, int x[][2], vector<int>& v) {
  memset(cnt, 0, sizeof(cnt));
  memset(res, 0, sizeof(res));
  for (int i = 1; i <= n; i++) {
    int p1 = mp[x[i][0]], p2 = mp[x[i][1]];
    cnt[p1] += 1, cnt[p2 + 1] += -1;
  }
  for (int i = 1; i <= n * 2; i++) {
    res[i] = res[i - 1] + cnt[i];
    if (res[i] >= n - 1) {
      for (auto m : mp) {
        if (m.second == i) v.push_back(m.first);
      }
    }
  }
}
int check(int x, int u) {
  int num = 0;
  for (int i = 1; i <= n; i++) {
    if (x <= a[i][1] && x >= a[i][0] && u <= b[i][1] && u >= b[i][0]) {
      num++;
    }
  }
  if (num >= n - 1) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d %d", &a[i][0], &b[i][0], &a[i][1], &b[i][1]);
    s1.insert(a[i][0]);
    s1.insert(a[i][1]);
    s2.insert(b[i][0]);
    s2.insert(b[i][1]);
  }
  int j = 0;
  for (auto s : s1) {
    j++;
    mp1[s] = j;
  }
  j = 0;
  for (auto s : s2) {
    j++;
    mp2[s] = j;
  }
  solve1(mp1, a, v1);
  solve1(mp2, b, v2);
  for (int i = 0; i < v1.size(); i++) {
    for (int j = 0; j < v2.size(); j++) {
      if (check(v1[i], v2[j])) {
        printf("%d %d\n", v1[i], v2[j]);
        return 0;
      }
    }
  }
}
