#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int x, y;
} point;
typedef struct {
  point a, b;
  int coord;
  int type;
} segment;
void swap_point(point &a, point &b) {
  point c = a;
  a = b;
  b = c;
}
void swap_segm(segment &a, segment &b) {
  segment c = a;
  a = b;
  b = c;
}
void inp_point(point &a) { cin >> a.x >> a.y; }
void inp_segment(segment &s) {
  inp_point(s.a);
  inp_point(s.b);
  if (s.a.y == s.b.y) {
    if (s.a.x == s.b.x)
      s.type = 2;
    else {
      s.type = 0;
      s.coord = s.a.y;
      if (s.a.x > s.b.x) swap_point(s.a, s.b);
    }
  }
  if (s.a.x == s.b.x) {
    if (s.a.y == s.b.y)
      s.type = 2;
    else {
      s.type = 1;
      s.coord = s.a.x;
      if (s.a.y > s.b.y) swap_point(s.a, s.b);
    }
  }
}
bool eq_points(point a, point b) {
  if (a.x != b.x) return false;
  if (a.y != b.y) return false;
  return true;
}
int main() {
  segment s[4];
  segment hor[4], ver[4];
  int horc = 0, verc = 0;
  for (int i = 0; i < 4; i++) {
    inp_segment(s[i]);
    if (s[i].type == 0) {
      hor[horc] = s[i];
      horc++;
    }
    if (s[i].type == 1) {
      ver[verc] = s[i];
      verc++;
    }
  }
  bool ans = true;
  if (horc == 2) {
    if (hor[0].coord > hor[1].coord) swap_segm(hor[0], hor[1]);
    if (hor[0].coord == hor[1].coord) ans = false;
  } else
    ans = false;
  if (verc == 2) {
    if (ver[0].coord > ver[1].coord) swap_segm(ver[0], ver[1]);
    if (ver[0].coord == ver[1].coord) ans = false;
  } else
    ans = false;
  if (ans) {
    if (not eq_points(ver[0].a, hor[0].a)) ans = false;
    if (not eq_points(ver[0].b, hor[1].a)) ans = false;
    if (not eq_points(ver[1].a, hor[0].b)) ans = false;
    if (not eq_points(ver[1].b, hor[1].b)) ans = false;
  }
  if (ans)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
