#include <bits/stdc++.h>
using namespace std;
struct pt {
  int x, y;
};
pt st[8], sor[8];
bool cmp(const pt &a, const pt &b) {
  return a.x < b.x || a.x == b.x && a.y < b.y;
}
const bool operator!=(const pt &a, const pt &b) {
  return a.x != b.x || a.y != b.y;
}
const bool operator==(const pt &a, const pt &b) {
  return a.x == b.x && a.y == b.y;
}
int main() {
  pt a;
  int it = 0;
  int xmin = 1000000001, xmax = -1000000001, ymin = 1000000001,
      ymax = -1000000001;
  for (int i = 0; i < 8; ++i) {
    scanf("%d %d", &a.x, &a.y);
    if (a.x < xmin) xmin = a.x;
    if (a.x > xmax) xmax = a.x;
    if (a.y < ymin) ymin = a.y;
    if (a.y > ymax) ymax = a.y;
    sor[it] = a;
    st[it++] = a;
  }
  for (int i = 0; i < 4; ++i) {
    if (st[2 * i] == st[2 * i + 1]) {
      printf("NO");
      return 0;
    }
  }
  sort(sor, sor + it, cmp);
  int cnt = 1;
  for (int i = 1; i < 8; ++i)
    if (sor[i] != sor[i - 1]) ++cnt;
  if (cnt != 4 || sor[1] == sor[2] || sor[3] == sor[4] || sor[5] == sor[6]) {
    printf("NO");
    return 0;
  }
  if (xmin == xmax || ymin == ymax) {
    printf("NO");
    return 0;
  }
  bool left = false, right = false, up = false, down = false;
  for (int i = 0; i < 8; ++i) {
    if (st[i] == sor[0]) {
      int k = i + (1 - 2 * (i % 2));
      if (st[k].x == xmin) left = true;
      if (st[k].y == ymin) down = true;
    }
  }
  for (int i = 0; i < 8; ++i) {
    if (st[i] == sor[7]) {
      int k = i + (1 - 2 * (i % 2));
      if (st[k].x == xmax) right = true;
      if (st[k].y == ymax) up = true;
    }
  }
  if (!up || !down || !left || !right) {
    printf("NO");
    return 0;
  }
  printf("YES");
  return 0;
}
