#include <bits/stdc++.h>
using namespace std;
struct Rectangle {
  int Xleft, Xright, Yleft, Yright;
};
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  vector<Rectangle> RECT;
  Rectangle R;
  cin >> n;
  int x1, x2, y1, y2;
  vector<int> leftX, leftY, rightY, rightX;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    leftX.push_back(x1);
    leftY.push_back(y1);
    rightX.push_back(x2);
    rightY.push_back(y2);
    R.Xleft = x1;
    R.Yleft = y1;
    R.Xright = x2;
    R.Yright = y2;
    RECT.push_back(R);
  }
  sort(leftX.begin(), leftX.end());
  sort(leftY.begin(), leftY.end());
  sort(rightX.begin(), rightX.end());
  sort(rightY.begin(), rightY.end());
  if (leftX[n - 1] <= rightX[0] && leftY[n - 1] <= rightY[0]) {
    cout << leftX[n - 1] << " " << leftY[n - 1];
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int leftx = n - 1, lefty = n - 1, rightx = 0, righty = 0;
    int xl =
        upper_bound(leftX.begin(), leftX.end(), RECT[i].Xleft) - leftX.begin();
    int yl =
        upper_bound(leftY.begin(), leftY.end(), RECT[i].Yleft) - leftY.begin();
    int xr = lower_bound(rightX.begin(), rightX.end(), RECT[i].Xright) -
             rightX.begin();
    int yr = lower_bound(rightY.begin(), rightY.end(), RECT[i].Yright) -
             rightY.begin();
    if (xl - 1 == n - 1) leftx--;
    if (xr == 0) rightx++;
    if (yl - 1 == n - 1) lefty--;
    if (yr == 0) righty++;
    if (leftX[leftx] <= rightX[rightx] && leftY[lefty] <= rightY[righty]) {
      cout << leftX[leftx] << " " << leftY[lefty];
      return 0;
    }
  }
  return 0;
}
