#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int> > > v(4);
vector<int> len;
int main() {
  int x, y;
  for (int i = 0; i < 4; ++i) {
    for (int j = 0; j < 2; ++j) {
      scanf("%d%d", &x, &y);
      v[i].push_back({x, y});
    }
  }
  for (int i = 0; i < 4; ++i) sort(v[i].begin(), v[i].end());
  sort(v.begin(), v.end());
  bool ok = 0;
  int mx_x = max(v[0][1].first, v[1][1].first),
      mx_y = max(v[0][1].second, v[1][1].second);
  if ((v[0][0].first == v[1][0].first) && (v[0][0].second == v[1][0].second)) {
    if ((v[2][1].first == v[3][1].first) &&
        (v[2][1].second == v[3][1].second)) {
      if (((v[0][1].first == v[2][0].first) &&
           (v[0][1].second == v[2][0].second) &&
           (v[1][1].first == v[3][0].first) &&
           (v[1][1].second == v[3][0].second)) ||
          ((v[0][1].first == v[3][0].first) &&
           (v[0][1].second == v[3][0].second) &&
           (v[1][1].first == v[2][0].first) &&
           (v[1][1].second == v[2][0].second))) {
        if (v[2][1].first == mx_x && v[2][1].second == mx_y) {
          ok = 1;
        }
      }
    }
  }
  long long area = 0LL;
  for (int i = 0; i < 4; ++i)
    len.push_back(max(abs(v[i][0].first - v[i][1].first),
                      abs(v[i][0].second - v[i][1].second)));
  sort(len.begin(), len.end());
  if (ok) {
    if ((len[0] == len[1]) && (len[2] == len[3])) {
      area = 1LL * len[0] * len[2];
      if (area > 0)
        puts("YES");
      else
        puts("NO");
    } else
      puts("NO");
  } else
    puts("NO");
  return 0;
}
