#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 1;
int n;
int check(vector<pair<int, int>> vec) {
  sort(vec.begin(), vec.end());
  int mx = 0;
  for (int i = 0; i < (int)vec.size() - 1; ++i) {
    mx = max(mx, vec[i].second);
    if (vec[i + 1].first >= mx) {
      return mx;
    }
  }
  return -1;
}
bool solve(vector<pair<pair<int, int>, pair<int, int>>> vec) {
  if (vec.size() == 1) return true;
  vector<pair<int, int>> x, y;
  for (auto i : vec) {
    x.push_back(i.first);
    y.push_back(i.second);
  }
  int div = check(x);
  if (div != -1) {
    vector<pair<pair<int, int>, pair<int, int>>> v1, v2;
    for (auto i : vec) {
      if (i.first.first <= div && i.first.second <= div) {
        v1.push_back(i);
      } else {
        v2.push_back(i);
      }
    }
    return (solve(v1) && solve(v2));
  }
  div = check(y);
  if (div == -1) return false;
  vector<pair<pair<int, int>, pair<int, int>>> v1, v2;
  for (auto i : vec) {
    if (i.second.first <= div && i.second.second <= div) {
      v1.push_back(i);
    } else {
      v2.push_back(i);
    }
  }
  return (solve(v1) && solve(v2));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<pair<pair<int, int>, pair<int, int>>> vec;
  for (int i = 0; i < n; ++i) {
    vec.push_back(pair<pair<int, int>, pair<int, int>>());
    cin >> vec.back().first.first >> vec.back().second.first >>
        vec.back().first.second >> vec.back().second.second;
  }
  if (solve(vec)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}
