#include <bits/stdc++.h>
using namespace std;
int a[1005];
struct node {
  int x1, x2;
  int y1, y2;
} x[30], y[30], p;
int main() {
  int i, j, top1 = 0, top2 = 0;
  long long s;
  for (i = 1; i <= 4; i++) {
    scanf("%d%d%d%d", &p.x1, &p.y1, &p.x2, &p.y2);
    if (p.x1 == p.x2 && p.y1 != p.y2) x[top1++] = p;
    if (p.x1 != p.x2 && p.y1 == p.y2) y[top2++] = p;
  }
  if (x[0].x1 > x[1].x1) {
    swap(x[0], x[1]);
  }
  for (i = 0; i < 2; i++) {
    if (x[i].y1 > x[i].y2) {
      swap(x[i].x1, x[i].x2);
      swap(x[i].y1, x[i].y2);
    }
  }
  if (y[0].y1 > y[1].y1) {
    swap(y[0], y[1]);
  }
  for (i = 0; i < 2; i++) {
    if (y[i].x1 > y[i].x2) {
      swap(y[i].x1, y[i].x2);
      swap(y[i].y1, y[i].y2);
    }
  }
  s = (x[1].x1 - x[0].x1) * (y[1].y1 - y[0].y1);
  if (top1 != 2 || top2 != 2 || s == 0)
    puts("NO");
  else {
    if (x[0].x1 == y[0].x1 && x[0].x1 == y[1].x1 && x[1].x2 == y[0].x2 &&
        x[1].x2 == y[1].x2 && y[0].y1 == x[0].y1 && y[0].y1 == x[1].y1 &&
        y[1].y2 == x[0].y2 && y[1].y2 == x[1].y2)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
