#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<pair<int, int>>> v;
  for (int i = 0; i < 4; i++) {
    int x1, x2, x3, x4;
    cin >> x1 >> x2 >> x3 >> x4;
    v.push_back({{x1, x2}, {x3, x4}});
  }
  map<pair<int, int>, int> cnt;
  for (auto x : v) {
    cnt[x[0]] = cnt[x[0]] + 1;
    cnt[x[1]] = cnt[x[1]] + 1;
  }
  for (auto x : cnt) {
    if (x.second != 2) {
      cout << "NO";
      return 0;
    }
  }
  unordered_map<int, int> sides;
  int xp = 0, yp = 0;
  for (auto x : v) {
    if (x[0].first != x[1].first && x[0].second != x[1].second) {
      cout << "NO";
      return 0;
    }
    if (x[0].first != x[1].first) {
      yp++;
    } else {
      xp++;
    }
    sides[abs(x[0].first - x[1].first) + abs(x[0].second - x[1].second)]++;
  }
  if (xp != 2 || yp != 2) {
    cout << "NO";
    return 0;
  }
  if (sides.size() > 2) {
    cout << "NO";
    return 0;
  }
  for (auto x : v) {
    if (x[0].first == x[1].first && x[0].second == x[1].second) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
