#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, p;
  bool operator<(const node _) const {
    if (x == _.x && y == _.y) return p < _.p;
    if (x == _.x) return y < _.y;
    return x < _.x;
  }
} g[4][100005];
int f[4][100005], n;
set<node> x[4];
const int inf = 2e9;
int solve(set<node> t[4]) {
  int n = t[0].size();
  set<node> s[4];
  set<node>::iterator it[4];
  for (int i = 0; i < 4; i++) it[i] = t[i].begin();
  if (n == 1) return 1;
  int mx[4] = {-inf, -inf, -inf, -inf};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      f[j][i] = it[j]->p;
      if (i && it[j]->x >= mx[j]) {
        for (int k = 0; k < i; k++)
          for (int l = 0; l < 4; l++) {
            s[l].insert(g[l][f[j][k]]);
            t[l].erase(g[l][f[j][k]]);
          }
        return solve(s) && solve(t);
      }
      mx[j] = max(mx[j], it[j]->y);
      it[j]++;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    g[0][i] = (node)<% a, c, i %>;
    x[0].insert(g[0][i]);
    g[1][i] = (node)<% -c, -a, i %>;
    x[1].insert(g[1][i]);
    g[2][i] = (node)<% b, d, i %>;
    x[2].insert(g[2][i]);
    g[3][i] = (node)<% -d, -b, i %>;
    x[3].insert(g[3][i]);
  }
  puts(solve(x) ? "yes" : "no");
  return 0;
}
