#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
const int INF = 1000000000;
const int MAX = 1 << 17;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<pair<pair<long long, long long>, pair<long long, long long> > > a;
  for (int i = (0); i < (n); ++i) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    a.push_back(make_pair(make_pair(x1, y1), make_pair(x2, y2)));
  }
  for (int mask = (1); mask < (1 << n); ++mask) {
    mask = (1 << n) - 1;
    long long s = 0;
    long long mx = INF;
    long long my = INF;
    long long Mx = -INF;
    long long My = -INF;
    for (int i = (0); i < (n); ++i)
      if (mask & (1 << i)) {
        s += (a[i].second.first - a[i].first.first) *
             (a[i].second.second - a[i].first.second);
        mx = min(mx, a[i].first.first);
        my = min(my, a[i].first.second);
        Mx = max(Mx, a[i].second.first);
        My = max(My, a[i].second.second);
      }
    if (Mx - mx == My - my && (Mx - mx) * (My - my) == s) {
      cout << "YES\n";
      return 0;
    }
  }
  cout << "NO\n";
  return 0;
}
