#include <bits/stdc++.h>
using namespace std;
long long int powermodm(long long int x, long long int n, long long int M) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % M;
    x = (x * x) % M;
    n = n / 2;
  }
  return result;
}
long long int power(long long int _a, long long int _b) {
  long long int _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a);
    _b /= 2;
    _a = (_a * _a);
  }
  return _r;
}
long long int gcd(long long int a, long long int b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
long long int lcm(long long int a, long long int b) {
  return (max(a, b) / gcd(a, b)) * min(a, b);
}
vector<long long int> inter(long long int x1, long long int x2,
                            long long int y1, long long int y2,
                            long long int a1, long long int a2,
                            long long int b1, long long int b2) {
  vector<long long int> ans;
  ans.push_back(max(x1, a1));
  ans.push_back(min(x2, a2));
  ans.push_back(max(y1, b1));
  ans.push_back(min(y2, b2));
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int x1[n + 1], y1[n + 1], i, j, x2[n + 1], y2[n + 1];
  long long int dp1x1[n + 2], dp1x2[n + 1], dp1y1[n + 2], dp1y2[n + 2];
  long long int dp2x1[n + 2], dp2x2[n + 1], dp2y1[n + 2], dp2y2[n + 2];
  dp1x1[0] = -LONG_MAX;
  dp1x2[0] = LONG_MAX;
  dp1y1[0] = -LONG_MAX;
  dp1y2[0] = LONG_MAX;
  dp2x1[n + 1] = -LONG_MAX;
  dp2x2[n + 1] = LONG_MAX;
  dp2y1[n + 1] = -LONG_MAX;
  dp2y2[n + 1] = LONG_MAX;
  for (i = 1; i <= n; i++) {
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    vector<long long int> temp =
        inter(dp1x1[i - 1], dp1x2[i - 1], dp1y1[i - 1], dp1y2[i - 1], x1[i],
              x2[i], y1[i], y2[i]);
    dp1x1[i] = temp[0];
    dp1x2[i] = temp[1];
    dp1y1[i] = temp[2];
    dp1y2[i] = temp[3];
  }
  for (i = n; i >= 1; i--) {
    vector<long long int> temp =
        inter(dp2x1[i + 1], dp2x2[i + 1], dp2y1[i + 1], dp2y2[i + 1], x1[i],
              x2[i], y1[i], y2[i]);
    dp2x1[i] = temp[0];
    dp2x2[i] = temp[1];
    dp2y1[i] = temp[2];
    dp2y2[i] = temp[3];
  }
  for (i = 1; i <= n; i++) {
    vector<long long int> temp =
        inter(dp1x1[i - 1], dp1x2[i - 1], dp1y1[i - 1], dp1y2[i - 1],
              dp2x1[i + 1], dp2x2[i + 1], dp2y1[i + 1], dp2y2[i + 1]);
    if (temp[0] <= temp[1] && temp[2] <= temp[3]) {
      cout << temp[0] << " " << temp[2] << endl;
      return 0;
    }
  }
  return 0;
}
