#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
using namespace std;
const long long MAX = -1000000000000000000;
const long long MIN = 1000000000000000000;
const long long inf = 1000000000;
const long long KOK = 100000;
const long long LOG = 30;
const long long li = 500005;
const long long mod = 1000000007;
int n, m, b[li], a[li], k, flag, t;
int cev;
string s;
pair<long long, pair<long long, pair<long long, long long> > > p[10];
vector<int> v;
vector<pair<long long, pair<long long, pair<long long, long long> > > > dikey,
    yatay;
int main(void) {
  n = 4;
  for (int i = 1; i <= 4; i++) {
    scanf("%lld %lld %lld %lld", &p[i].first, &p[i].second.first,
          &p[i].second.second.first, &p[i].second.second.second);
    if (p[i].first == p[i].second.second.first &&
        p[i].second.first > p[i].second.second.second)
      swap(p[i].second.second.second, p[i].second.first);
    if (p[i].first > p[i].second.second.first &&
        p[i].second.first == p[i].second.second.second)
      swap(p[i].second.second.first, p[i].first);
    if (p[i].first == p[i].second.first &&
        p[i].first == p[i].second.second.first &&
        p[i].first == p[i].second.second.second) {
      printf("NO\n");
      return 0;
    }
  }
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) {
    if (p[i].first == p[i].second.second.first)
      dikey.push_back(p[i]);
    else
      yatay.push_back(p[i]);
  }
  if (dikey.size() != 2 || yatay.size() != 2) {
    printf("NO\n");
    return 0;
  }
  if (dikey[0].second.first != dikey[1].second.first) {
    printf("NO\n");
    return 0;
  }
  if (dikey[0].second.second.second != dikey[1].second.second.second) {
    printf("NO\n");
    return 0;
  }
  if (yatay[0].second.second.first != yatay[1].second.second.first) {
    printf("NO\n");
    return 0;
  }
  if (yatay[0].first != yatay[1].first) {
    printf("NO\n");
    return 0;
  }
  if (dikey[0].second.first != yatay[0].second.first ||
      dikey[0].second.second.second != yatay[1].second.first) {
    printf("NO\n");
    return 0;
  }
  if (yatay[0].first != dikey[0].first ||
      yatay[0].second.second.first != dikey[1].first) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}
