#include <bits/stdc++.h>
using namespace std;
const long long maxn = 232674;
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
const double pi = acos(-1.0);
struct node {
  long long x1, y1, x2, y2;
};
node a[maxn], pre[maxn], pos[maxn];
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
  }
  node st = a[1], ed = a[n];
  pre[0].x1 = -2e9, pre[0].y1 = -2e9, pre[0].x2 = 2e9, pre[0].y2 = 2e9;
  pos[n + 1].x1 = -2e9, pos[n + 1].y1 = -2e9, pos[n + 1].x2 = 2e9,
          pos[n + 1].y2 = 2e9;
  for (long long i = 1, j = n; i <= n; i++, j--) {
    st.x1 = max(st.x1, a[i].x1), st.y1 = max(st.y1, a[i].y1);
    st.x2 = min(st.x2, a[i].x2), st.y2 = min(st.y2, a[i].y2);
    pre[i] = st;
    ed.x1 = max(ed.x1, a[j].x1), ed.y1 = max(ed.y1, a[j].y1);
    ed.x2 = min(ed.x2, a[j].x2), ed.y2 = min(ed.y2, a[j].y2);
    pos[j] = ed;
  }
  for (long long i = 1; i <= n; i++) {
    node t;
    t.x1 = max(pre[i - 1].x1, pos[i + 1].x1),
    t.y1 = max(pre[i - 1].y1, pos[i + 1].y1);
    t.x2 = min(pre[i - 1].x2, pos[i + 1].x2),
    t.y2 = min(pre[i - 1].y2, pos[i + 1].y2);
    if (t.x2 - t.x1 >= 0 && t.y2 - t.y1 >= 0) {
      cout << t.x1 << " " << t.y1 << endl;
      break;
    }
  }
  return 0;
}
