#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;
template <typename T>
void check(T& a, const T& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
LL mulmod(LL a, LL b, const LL& m) {
  LL q = (LL)(((LD)a * (LD)b) / (LD)m);
  LL r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T, typename S>
T expo(T e, S n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, const T& m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  vector<vpii> v, px, py;
  for (int i = 0; i < 4; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    v.push_back({{a, b}, {c, d}});
    if (v[i][0] == v[i][1]) {
      cout << "NO\n";
      return 0;
    }
    if (v[i][0].second == v[i][1].second) {
      if (v[i][0].first > v[i][1].first) swap(v[i][0], v[i][1]);
      px.push_back(v[i]);
    } else if (v[i][0].first == v[i][1].first) {
      if (v[i][0].second > v[i][1].second) swap(v[i][0], v[i][1]);
      py.push_back(v[i]);
    }
  }
  if (px.size() != 2 || py.size() != 2) {
    cout << "NO\n";
    return 0;
  }
  int rx = (int)1e9 + 10, lx = -rx;
  vi xy;
  int ry = (int)1e9 + 10, ly = -ry;
  vi yx;
  for (auto& i : px) {
    xy.push_back(i[0].second);
  }
  sort(xy.begin(), xy.end());
  for (auto& i : py) {
    yx.push_back(i[0].first);
  }
  sort(yx.begin(), yx.end());
  if (px[0][0].first != px[1][0].first || px[0][1].first != px[1][1].first ||
      py[0][0].second != py[1][0].second ||
      py[0][1].second != py[1][1].second) {
    cerr << " here \n";
    ;
    cout << "NO\n";
    return 0;
  }
  if (xy[0] == py[0][0].second && xy[1] == py[0][1].second &&
      yx[0] == px[0][0].first && yx[1] == px[0][1].first) {
    cout << "YES\n";
    return 0;
  } else
    cout << "NO\n";
  return 0;
}
