#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long double PI = acos(-1);
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int n;
long long x1[N], sdiufdsugf[N], x2[N], y2[N];
multiset<int> xmi, ymi, xma, yma;
bool check(int xl, int yl, int xr, int yr) { return xr >= xl and yr >= yl; }
int retx, rety;
bool test(int i) {
  int xl = x1[i], xr = x2[i];
  int yl = sdiufdsugf[i], yr = y2[i];
  auto it1 = xmi.find(xl);
  auto it2 = xma.find(xr);
  auto it3 = ymi.find(yl);
  auto it4 = yma.find(yr);
  xmi.erase(it1);
  xma.erase(it2);
  ymi.erase(it3);
  yma.erase(it4);
  int mix = *xma.begin();
  int miy = *yma.begin();
  int mx = *prev(xmi.end());
  int my = *prev(ymi.end());
  bool ans = check(mx, my, mix, miy);
  if (ans) retx = mx, rety = my;
  xmi.insert(xl);
  xma.insert(xr);
  ymi.insert(yl);
  yma.insert(yr);
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld %lld %lld %lld", &x1[i], &sdiufdsugf[i], &x2[i], &y2[i]);
    xmi.insert(x1[i]);
    ymi.insert(sdiufdsugf[i]);
    xma.insert(x2[i]);
    yma.insert(y2[i]);
  }
  for (int i = 0; i < n; i++)
    if (test(i)) {
      printf("%d %d\n", retx, rety);
      return 0;
    }
  return 0;
}
