#include <bits/stdc++.h>
using namespace std;
int main() {
  int x11, y11, x22, y22;
  int x[8], y[8];
  int resxmn = -1, resxmx = -1, resymn = -1, resymx = -1;
  bool answ = true;
  for (int i = 0; i < 4; i++) {
    scanf("%d %d %d %d", &x11, &y11, &x22, &y22);
    x[2 * i] = x11;
    x[2 * i + 1] = x22;
    y[2 * i] = y11;
    y[2 * i + 1] = y22;
    if (x11 != x22 && y11 != y22) answ = false;
    if (x11 == x22) {
      if (y11 > y22) swap(y11, y22);
      if (resymn != -1 && resymn != y11) answ = false;
      resymn = y11;
      if (resymx != -1 && resymx != y22) answ = false;
      resymx = y22;
    }
    if (y11 == y22) {
      if (x11 > x22) swap(x11, x22);
      if (resxmn != -1 && resxmn != x11) answ = false;
      resxmn = x11;
      if (resxmx != -1 && resxmx != x22) answ = false;
      resxmx = x22;
    }
  }
  if ((resxmx - resxmn) <= 0 || (resymx - resymn) <= 0) answ = false;
  int was[4];
  for (int i = 0; i < 4; i++) was[i] = false;
  for (int i = 0; i < 4; i++) {
    if (x[2 * i] == x[2 * i + 1]) {
      if (x[2 * i] == resxmx) was[2] = true;
      if (x[2 * i] == resxmn) was[0] = true;
    };
    if (y[2 * i] == y[2 * i + 1]) {
      if (y[2 * i] == resymx) was[1] = true;
      if (y[2 * i] == resymn) was[3] = true;
    }
  }
  for (int i = 0; i < 4; i++) {
    if (!was[i]) answ = false;
  }
  if (answ)
    puts("YES");
  else
    puts("NO");
}
