#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int inf = 1e7;
const int MAXM = 2e5 + 5;
const int MAXN = 3e3 + 4;
vector<pair<double, double> > p;
map<pair<double, double>, int> m;
vector<double> v;
double dist(int x, int y) {
  double d = (((p[x].first - p[y].first) * (p[x].first - p[y].first)) +
              ((p[x].second - p[y].second) * (p[x].second - p[y].second)));
  return sqrt(d);
}
bool check(int x, int y, int z) {
  if (p[x].first == p[y].first and p[x].first == p[z].first) return true;
  if (p[x].second == p[y].second and p[x].second == p[z].second) return true;
  return false;
}
bool com(int x, int y) {
  if (p[x].first == p[y].first or p[x].second == p[y].second) return true;
  return false;
}
bool chk(int x, int y, int u, int v) {
  if (dist(x, y) > dist(x, u) and dist(x, y) > dist(x, v)) {
    if (com(x, y)) return false;
  }
  if (dist(x, u) > dist(x, y) and dist(x, u) > dist(x, v)) {
    if (com(x, u)) return false;
  }
  if (dist(x, v) > dist(x, u) and dist(x, v) > dist(x, y)) {
    if (com(x, v)) return false;
  }
  return true;
}
int main() {
  int n, i, j, k;
  n = 4;
  for (i = 1; i <= n; i++) {
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (m[make_pair(x1, y1)] == 0) {
      m[make_pair(x1, y1)] = 1;
      p.push_back(make_pair(x1, y1));
    }
    if (m[make_pair(x2, y2)] == 0) {
      m[make_pair(x2, y2)] = 1;
      p.push_back(make_pair(x2, y2));
    }
  }
  if (p.size() != 4) {
    cout << "NO\n";
    return 0;
  }
  if (check(0, 1, 2) or check(1, 2, 3) or check(0, 1, 3) or check(0, 2, 3)) {
    cout << "NO\n";
    return 0;
  }
  sort(p.begin(), p.end());
  if (!chk(0, 1, 2, 3)) {
    cout << "NO\n";
    return 0;
  }
  double p1 = dist(0, 1);
  double p2 = dist(1, 2);
  double p3 = dist(2, 3);
  double p4 = dist(3, 0);
  double p5 = dist(0, 2);
  double p6 = dist(1, 3);
  v.push_back(p1);
  v.push_back(p2);
  v.push_back(p3);
  v.push_back(p4);
  v.push_back(p5);
  v.push_back(p6);
  sort(v.begin(), v.end());
  if (v[0] != v[1] or v[2] != v[3] or v[4] != v[5]) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  return 0;
}
