#include <bits/stdc++.h>
using namespace std;
const long long int no = 3e6 + 5, modulo = 1e9 + 7, inf = 1e18, N = 3e3 + 1;
void solve() {
  long long int n = 0, m = 0, a = 0, b = 0, c = 0, d = 0, x = 0, y = 0, z = 0,
                w = 0, k = 0;
  map<pair<long long int, long long int>, long long int> mapp;
  a = inf;
  b = -inf;
  c = -inf;
  d = inf;
  for (long long int i = 0; i < 4; i++) {
    cin >> x >> y;
    mapp[{x, y}]++;
    a = min(a, x);
    c = max(c, x);
    b = max(b, y);
    d = min(d, y);
    cin >> x >> y;
    mapp[{x, y}]++;
    a = min(a, x);
    c = max(c, x);
    b = max(b, y);
    d = min(d, y);
  }
  if (mapp.size() == 4) {
    if (mapp[{a, d}] != 2)
      cout << "NO";
    else if (mapp[{a, b}] != 2)
      cout << "NO";
    else if (mapp[{c, b}] != 2)
      cout << "NO";
    else if (mapp[{c, d}] != 2)
      cout << "NO";
    else {
      if (a == c || b == d)
        cout << "NO";
      else
        cout << "YES";
    }
  } else
    cout << "NO";
}
inline void runn() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  for (long long int i = 1; i < t + 1; i++) {
    solve();
  }
}
