#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
};
struct segment {
  point b, e;
  int l;
};
int main() {
  segment arr[5];
  int x = 0, y = 0;
  for (int i = 0; i < 4; i++) {
    point p1, p2;
    cin >> p1.x >> p1.y >> p2.x >> p2.y;
    if (p1.x == p2.x) {
      y++;
    }
    if (p1.y == p2.y) {
      x++;
    }
    arr[i].b = p1;
    arr[i].e = p2;
    arr[i].l = 0;
  }
  for (int i = 0; i < 4; i++) {
    point p1, p2;
    p1 = arr[i].b;
    p2 = arr[i].e;
    if (((p1.x == p2.x) && (p1.y == p2.y)) ||
        ((p1.x != p2.x) && (p1.y != p2.y))) {
      cout << "NO" << endl;
      return 0;
    }
  }
  map<int, int> mp1;
  map<pair<int, int>, int> mp2;
  for (int i = 0; i < 4; i++) {
    arr[i].l = (arr[i].b.x - arr[i].e.x) * (arr[i].b.x - arr[i].e.x) +
               (arr[i].b.y - arr[i].e.y) * (arr[i].b.y - arr[i].e.y);
    mp2[make_pair(arr[i].b.x, arr[i].b.y)]++;
    mp2[make_pair(arr[i].e.x, arr[i].e.y)]++;
    if (mp2[make_pair(arr[i].b.x, arr[i].b.y)] > 2) {
      cout << "NO" << endl;
      return 0;
    }
    if (mp2[make_pair(arr[i].e.x, arr[i].e.y)] > 2) {
      cout << "NO" << endl;
      return 0;
    }
    mp1[arr[i].l]++;
  }
  if (mp2.size() == 4 && (mp1.size() == 2 || mp1.size() == 1) && x == 2 &&
      y == 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
