#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const double EPS = 1e-9;
const double PI = 3.14159265359;
struct t {
  int x, ind;
  t(int a = 0, int b = 0) { x = a, ind = b; }
};
void print(string s, vector<t> &a) {
  cout << s << ":\n";
  for (auto i : a) cout << i.x << " ";
  cout << endl;
}
bool c1(t a, t b) { return a.x < b.x; }
bool c2(t a, t b) { return a.x > b.x; }
struct id {
  int ixL, ixR, iyL, iyR;
  id(int a = 0, int b = 0, int c = 0, int d = 0) {
    ixL = a, ixR = b, iyL = c, iyR = d;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<t> xL(n), xR(n), yL(n), yR(n);
  for (int i = 0; i < n; ++i) {
    cin >> xL[i].x >> yL[i].x >> xR[i].x >> yR[i].x;
    xL[i].ind = xR[i].ind = yL[i].ind = yR[i].ind = i;
  }
  sort(xL.begin(), xL.end(), c2);
  sort(yL.begin(), yL.end(), c2);
  sort(xR.begin(), xR.end(), c1);
  sort(yR.begin(), yR.end(), c1);
  vector<id> a(n);
  for (int i = 0; i < n; ++i) {
    a[xL[i].ind].ixL = i;
    a[xR[i].ind].ixR = i;
    a[yL[i].ind].iyL = i;
    a[yR[i].ind].iyR = i;
  }
  int ansx = 0, ansy = 0;
  for (int i = 0; i < n; ++i) {
    int x1, y1, x2, y2;
    if (a[i].ixL == 0)
      x1 = xL[1].x;
    else
      x1 = xL[0].x;
    if (a[i].iyL == 0)
      y1 = yL[1].x;
    else
      y1 = yL[0].x;
    if (a[i].ixR == 0)
      x2 = xR[1].x;
    else
      x2 = xR[0].x;
    if (a[i].iyR == 0)
      y2 = yR[1].x;
    else
      y2 = yR[0].x;
    if (x1 <= x2 && y1 <= y2) {
      ansx = x1, ansy = y1;
    }
  }
  cout << ansx << " " << ansy;
  return 0;
}
