#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long int mod = 1e9 + 7;
long long int mod1 = 998244351;
long long int power(long long int a, long long int b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return power(a * a % mod, b / 2) % mod;
  else
    return (a % mod * power(a * a % mod, b / 2)) % mod;
}
long long int bit(long long int x) { return __builtin_popcountll(x); }
long long int temp1, temp2, temp3, temp4;
void fi(long long int x3, long long int y3, long long int x4,
        long long int y4) {
  long long int x5 = max(temp1, x3);
  long long int y5 = max(temp2, y3);
  long long int x6 = min(temp3, x4);
  long long int y6 = min(temp4, y4);
  if (x5 > x6 || y5 > y6) {
    temp1 = -1000000009, temp2 = -1e9 - 1, temp3 = -1e9 - 1, temp4 = -1e9 - 1;
    return;
  }
  temp1 = x5;
  temp2 = y5;
  temp3 = x6;
  temp4 = y6;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n], b[n], c[n], d[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  temp1 = a[0], temp2 = b[0], temp3 = c[0], temp4 = d[0];
  long long int count = 0;
  vector<int> index;
  for (int i = 1; i < n; ++i) {
    long long int p = temp1, p1 = temp2, p3 = temp3, p4 = temp4;
    fi(a[i], b[i], c[i], d[i]);
    if (temp1 == -1000000009) {
      temp1 = p;
      temp2 = p1;
      temp3 = p3;
      temp4 = p4;
      count++;
    }
  }
  if (count <= 1) {
    cout << temp1 << " " << temp2 << '\n';
    return 0;
  }
  temp1 = a[n - 1];
  temp2 = b[n - 1];
  temp3 = c[n - 1];
  temp4 = d[n - 1];
  count = 0;
  for (int i = n - 1; i >= 0; --i) {
    long long int p = temp1, p1 = temp2, p3 = temp3, p4 = temp4;
    fi(a[i], b[i], c[i], d[i]);
    if (temp1 == -1000000009) {
      temp1 = p;
      temp2 = p1;
      temp3 = p3;
      temp4 = p4;
      count++;
    }
  }
  if (count <= 1) {
    cout << temp1 << " " << temp2 << '\n';
    return 0;
  }
  temp1 = a[1], temp2 = b[1], temp3 = c[1], temp4 = d[1], count = 0;
  for (int i = 2; i < n; ++i) {
    long long int p = temp1, p1 = temp2, p3 = temp3, p4 = temp4;
    fi(a[i], b[i], c[i], d[i]);
  }
  cout << temp3 << " " << temp4 << '\n';
}
