#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
const long long int MAXN = 2e5 + 5;
const long long int mod = 998244353;
const long long int N = 200005;
void solve() {
  int n;
  cin >> n;
  vector<long long int> x1(n + 1), y1(n + 1), x2(n + 1), y2(n + 1);
  vector<long long int> prex1(n + 2), prex2(n + 2), prey1(n + 2), prey2(n + 2),
      suffx1(n + 2), suffx2(n + 2), suffy1(n + 2), suffy2(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
  }
  prex1[0] = prey1[0] = suffx1[n + 1] = suffy1[n + 1] = -1e10;
  prex2[0] = prey2[0] = suffx2[n + 1] = suffy2[n + 1] = 1e10;
  vector<pair<long long int, long long int>> vec1(n), vec2(n);
  for (int i = 1; i <= n; i++) {
    prex1[i] = max(prex1[i - 1], x1[i]);
    prey1[i] = max(prey1[i - 1], y1[i]);
    prex2[i] = min(prex2[i - 1], x2[i]);
    prey2[i] = min(prey2[i - 1], y2[i]);
  }
  for (int i = n; i >= 1; i--) {
    suffx1[i] = max(suffx1[i + 1], x1[i]);
    suffy1[i] = max(suffy1[i + 1], y1[i]);
    suffx2[i] = min(suffx2[i + 1], x2[i]);
    suffy2[i] = min(suffy2[i + 1], y2[i]);
  }
  for (int i = 1; i <= n; i++) {
    long long int x3 = max(prex1[i - 1], suffx1[i + 1]);
    long long int x4 = min(prex2[i - 1], suffx2[i + 1]);
    long long int y3 = max(prey1[i - 1], suffy1[i + 1]);
    long long int y4 = min(prey2[i - 1], suffy2[i + 1]);
    if (x3 > x4 || y3 > y4) {
      continue;
    } else {
      cout << x3 << " " << y3 << "\n";
      return;
    }
  }
  return;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
