#include <bits/stdc++.h>
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int x[5][2], y[5][2], i, j, found[4] = {0, 0, 0, 0};
  x[4][0] = 1000000001;
  x[4][1] = -1000000001;
  y[4][0] = 1000000001;
  y[4][1] = -1000000001;
  for (i = 0; i < 4; ++i) {
    for (j = 0; j < 2; ++j) {
      scanf("%d %d", x[i] + j, y[i] + j);
      x[4][0] = min(x[4][0], x[i][j]);
      y[4][0] = min(y[4][0], y[i][j]);
      x[4][1] = max(x[4][1], x[i][j]);
      y[4][1] = max(y[4][1], y[i][j]);
    }
    if (!((x[i][0] == x[i][1]) ^ (y[i][0] == y[i][1]))) {
      puts("NO");
      return 0;
    }
  }
  if (x[4][0] == x[4][1] || y[4][0] == y[4][1]) {
    puts("NO");
    return 0;
  }
  for (i = 0; i < 4; ++i) {
    if (x[i][0] == x[4][0]) {
      if (y[i][0] == y[4][0]) {
        if (x[i][1] == x[4][0] && y[i][1] == y[4][1]) ++found[0];
        if (x[i][1] == x[4][1] && y[i][1] == y[4][0]) ++found[1];
      } else if (y[i][0] == y[4][1]) {
        if (x[i][1] == x[4][0] && y[i][1] == y[4][0]) ++found[0];
        if (x[i][1] == x[4][1] && y[i][1] == y[4][1]) ++found[3];
      }
    } else if (x[i][0] == x[4][1]) {
      if (y[i][0] == y[4][0]) {
        if (x[i][1] == x[4][0] && y[i][1] == y[4][0]) ++found[1];
        if (x[i][1] == x[4][1] && y[i][1] == y[4][1]) ++found[2];
      } else if (y[i][0] == y[4][1]) {
        if (x[i][1] == x[4][1] && y[i][1] == y[4][0]) ++found[2];
        if (x[i][1] == x[4][0] && y[i][1] == y[4][1]) ++found[3];
      }
    }
  }
  for (i = 0; i < 4; ++i) {
    if (found[i] != 1) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}
