#include <bits/stdc++.h>
using namespace std;
inline void print(int n) {
  if (n == 0) {
    putchar('0');
    putchar('\n');
  } else if (n == -1) {
    putchar('-');
    putchar('1');
    putchar('\n');
  } else {
    char buf[11];
    buf[10] = '\n';
    int i = 9;
    while (n) {
      buf[i--] = n % 10 + '0';
      n /= 10;
    }
    while (buf[i] != '\n') putchar(buf[++i]);
  }
}
int read() {
  int cc = getc(stdin);
  for (; cc < '0' || cc > '9';) cc = getc(stdin);
  int ret = 0;
  for (; cc >= '0' && cc <= '9';) {
    ret = ret * 10 + cc - '0';
    cc = getc(stdin);
  }
  return ret;
}
string read1() {
  int cc = getc(stdin);
  for (; cc < '0' || cc > '9';) cc = getc(stdin);
  string r = "";
  for (; cc >= '0' && cc <= '9';) {
    r += cc;
    cc = getc(stdin);
  }
  return r;
}
int a[132680], b[132680], c[132680], d[132680], e[132680], f[132680], g[132680],
    h[132680], w[132680], x[132680], y[132680], z[132680];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    if (i == 0)
      e[i] = a[i], f[i] = b[i], g[i] = c[i], h[i] = d[i];
    else {
      e[i] = max(e[i - 1], a[i]);
      f[i] = max(f[i - 1], b[i]);
      g[i] = min(g[i - 1], c[i]);
      h[i] = min(h[i - 1], d[i]);
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (i == n - 1)
      w[i] = a[i], x[i] = b[i], y[i] = c[i], z[i] = d[i];
    else {
      w[i] = max(w[i + 1], a[i]);
      x[i] = max(x[i + 1], b[i]);
      y[i] = min(y[i + 1], c[i]);
      z[i] = min(z[i + 1], d[i]);
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (w[1] <= y[1] && x[1] <= z[1]) {
        cout << w[1] << " " << x[1] << endl;
        return 0;
      }
    } else if (i == n - 1) {
      if (e[n - 2] <= g[n - 2] && f[n - 2] <= h[n - 2]) {
        cout << e[n - 2] << " " << f[n - 2] << endl;
        return 0;
      }
    } else {
      int x1 = max(e[i - 1], w[i + 1]);
      int y1 = max(f[i - 1], x[i + 1]);
      int x2 = min(g[i - 1], y[i + 1]);
      int y2 = min(h[i - 1], z[i + 1]);
      if (x1 <= x2 && y1 <= y2) {
        cout << x1 << " " << y1 << endl;
        return 0;
      }
    }
  }
  return 0;
}
