#include <bits/stdc++.h>
using namespace std;
int main() {
  int x[2][4], y[2][4];
  set<pair<int, int> > s;
  for (int i = 0; i < 4; i++) {
    cin >> x[0][i] >> y[0][i] >> x[1][i] >> y[1][i];
    if (!(x[0][i] != x[1][i] || y[0][i] != y[1][i])) {
      cout << "NO";
      return 0;
    }
    s.insert({x[0][i], y[0][i]});
    s.insert({x[1][i], y[1][i]});
  }
  if (s.size() != 4) {
    cout << "NO";
    return 0;
  }
  vector<int> vx, vy;
  for (auto &i : s) vx.push_back(i.first), vy.push_back(i.second);
  if (vx[0] != vx[1] || vx[2] != vx[3] || vy[0] != vy[2] || vy[1] != vy[3] ||
      vx[0] >= vx[3] || vy[0] >= vy[1])
    cout << "NO";
  else
    cout << "YES";
}
