#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lb = 1000;
void vrikodara(long long n = 12) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(n) << fixed;
}
bool cmp(vector<long long> &v1, vector<long long> &v2) {
  if (v1[0] == v2[0] && v1[1] == v2[1]) {
    if (v1[2] == v2[2]) return v1[3] < v2[3];
    return v1[2] < v2[2];
  }
  if (v1[0] == v2[0]) return v1[1] < v2[1];
  return v1[0] < v2[0];
}
void solve() {
  vector<vector<long long>> v(4, vector<long long>(4));
  set<pair<long long, long long>> s;
  for (long long i = 0; i < 4; i++) {
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    s.insert({x1, y1});
    s.insert({x2, y2});
    if (x1 != x2 && y1 != y2) {
      cout << "NO";
      return;
    }
    if (x1 == x2) {
      if (y1 <= y2) {
        v[i][0] = x1;
        v[i][1] = y1;
        v[i][2] = x2;
        v[i][3] = y2;
        continue;
      }
      v[i][0] = x2;
      v[i][1] = y2;
      v[i][2] = x1;
      v[i][3] = y1;
      continue;
    } else {
      if (x1 <= x2) {
        v[i][0] = x1;
        v[i][1] = y1;
        v[i][2] = x2;
        v[i][3] = y2;
        continue;
      }
      v[i][0] = x2;
      v[i][1] = y2;
      v[i][2] = x1;
      v[i][3] = y1;
      continue;
    }
  }
  sort(v.begin(), v.end(), cmp);
  bool flag = true;
  long long sz = s.size();
  if (sz != 4) flag = false;
  if (v[0][0] != v[1][0] || v[0][1] != v[1][1]) flag = (flag and false);
  if (v[0][2] != v[2][0] || v[0][3] != v[2][1]) flag = (flag and false);
  if (v[1][2] != v[3][0] || v[1][3] != v[3][1]) flag = (flag and false);
  if (v[2][2] != v[3][2] || v[2][3] != v[3][3]) flag = (flag and false);
  if (flag)
    cout << "YES";
  else
    cout << "NO";
}
int32_t main() {
  vrikodara();
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
