#include <bits/stdc++.h>
using namespace std;
int maxans, minans, n, f;
struct item {
  int la, ra, lb, rb;
} lec[101000];
struct Segtr {
  int mi, ma;
} tr[101000 << 2];
void pushup(int pos) {
  tr[pos].ma = max(tr[pos << 1].ma, tr[pos << 1 | 1].ma);
  tr[pos].mi = min(tr[pos << 1].mi, tr[pos << 1 | 1].mi);
}
void build(int l = 1, int r = n, int pos = 1) {
  if (l == r) {
    tr[pos].mi = lec[l].rb;
    tr[pos].ma = lec[l].lb;
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, pos << 1), build(mid + 1, r, pos << 1 | 1);
  pushup(pos);
}
void querymax(int L, int R, int l = 1, int r = n, int pos = 1) {
  if (l > R || r < L) return;
  if (l >= L && r <= R) {
    maxans = max(maxans, tr[pos].ma);
    return;
  }
  int mid = (l + r) >> 1;
  querymax(L, R, l, mid, pos << 1), querymax(L, R, mid + 1, r, pos << 1 | 1);
}
void querymin(int L, int R, int l = 1, int r = n, int pos = 1) {
  if (l > R || r < L) return;
  if (l >= L && r <= R) {
    minans = min(minans, tr[pos].mi);
    return;
  }
  int mid = (l + r) >> 1;
  querymin(L, R, l, mid, pos << 1), querymin(L, R, mid + 1, r, pos << 1 | 1);
}
int find_(int x) {
  int l = 1, r = n, mid;
  while (r > l) {
    mid = (l + r) >> 1;
    if (lec[mid].la <= x)
      l = mid + 1;
    else
      r = mid;
  }
  if (lec[l].la > x) l--;
  return l;
}
void solve() {
  sort(lec + 1, lec + n + 1, [](item a, item b) { return a.la < b.la; });
  build();
  for (int i = 1; i <= n; i++) {
    int k = find_(lec[i].ra);
    if (k <= i) continue;
    maxans = -0x3f3f3f3f, minans = 0x3f3f3f3f;
    querymax(i + 1, k), querymin(i + 1, k);
    if (maxans > lec[i].rb) f = 1;
    if (minans < lec[i].lb) f = 1;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> lec[i].la >> lec[i].ra;
    cin >> lec[i].lb >> lec[i].rb;
  }
  solve();
  for (int i = 1; i <= n; i++) {
    swap(lec[i].la, lec[i].lb);
    swap(lec[i].ra, lec[i].rb);
  }
  solve();
  if (f)
    cout << "no";
  else
    cout << "yes";
  return 0;
}
