#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  Point(int x = 0, int y = 0) : x(x), y(y) {}
};
inline bool operator<(Point a, Point b) {
  if (a.x == b.x) {
    return a.y < b.y;
  }
  return a.x < b.x;
}
inline bool operator==(Point a, Point b) { return a.x == b.x && a.y == b.y; }
struct Seg {
  Point a, b;
  Seg(Point a = 0, Point b = 0) : a(a), b(b) {
    if (b < a) swap(a, b);
  }
};
inline bool operator<(Seg s, Seg t) {
  if (s.a == t.a) {
    return s.b < t.b;
  }
  return s.a < t.a;
}
set<Point> s;
set<Seg> S;
int main() {
  int hor = 0, vert = 0;
  for (int i = 0; i < 4; ++i) {
    Point a, b;
    scanf("%d %d %d %d", &a.x, &a.y, &b.x, &b.y);
    if (a.x != b.x && a.y != b.y) {
      puts("NO");
      return 0;
    }
    if (a.x == b.x && a.y == b.y) {
      puts("NO");
      return 0;
    }
    if (a.x == b.x) {
      hor++;
    } else
      vert++;
    s.insert(a);
    s.insert(b);
    S.insert(Seg(a, b));
  }
  ((int)(s).size() == 4 && (int)(S).size() == 4 && hor == 2 && vert == 2)
      ? puts("YES")
      : puts("NO");
  return 0;
}
