#include <bits/stdc++.h>
using namespace std;
struct pnt {
  int x, y;
};
struct seg {
  pnt s, e;
} sg;
vector<seg> x, y;
void getseg() { cin >> sg.s.x >> sg.s.y >> sg.e.x >> sg.e.y; }
bool equal(seg s1, seg s2) {
  return (s1.s.x == s2.s.x && s1.s.y == s2.s.y && s1.e.x == s2.e.x &&
          s1.e.y == s2.e.y);
}
bool in(seg s1, seg s2, seg s3, bool px) {
  if (px)
    return (s1.s.y >= max(s2.s.y, s3.s.y) && s1.s.y <= min(s2.e.y, s3.e.y));
  else
    return (s1.s.x >= max(s2.s.x, s3.s.x) && s1.s.x <= min(s2.e.x, s3.e.x));
}
bool rectangle() {
  return (x[0].s.x == x[1].s.x && x[0].e.x == x[1].e.x &&
          y[0].s.y == y[1].s.y && y[0].e.y == y[1].e.y &&
          abs(y[0].s.x - y[1].s.x) == abs(x[0].e.x - x[0].s.x) &&
          abs(x[0].s.y - x[1].s.y) == abs(y[0].e.y - y[0].s.y));
}
int main() {
  for (int i = 0; i < 4; i++) {
    getseg();
    if (sg.s.x == sg.e.x && sg.s.y == sg.e.y)
      return cout << "NO", 0;
    else if (sg.s.y == sg.e.y) {
      if (sg.s.x > sg.e.x) swap(sg.s, sg.e);
      x.push_back(sg);
    } else if (sg.s.x == sg.e.x) {
      if (sg.s.y > sg.e.y) swap(sg.s, sg.e);
      y.push_back(sg);
    } else
      return cout << "NO", 0;
  }
  if (x.size() < 2 || y.size() < 2 || equal(x[0], x[1]) || equal(y[0], y[1]))
    return cout << "NO", 0;
  if (in(x[0], y[0], y[1], 1) && in(x[1], y[0], y[1], 1) &&
      in(y[0], x[0], x[1], 0) && in(y[1], x[0], x[1], 0) && rectangle())
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
