#include <bits/stdc++.h>
int const N = 6 * 1e4 + 5;
using namespace std;
pair<pair<long long, long long>, pair<long long, long long> > p[4];
map<long long, long long> mpx, mpy;
map<pair<long long, long long>, long long> mpp;
map<pair<pair<long long, long long>, pair<long long, long long> >, long long> m;
int main() {
  for (int i = 0; i < 4; i++) {
    cin >> p[i].first.first >> p[i].first.second >> p[i].second.first >>
        p[i].second.second;
    mpx[p[i].first.first]++, mpx[p[i].second.first]++;
    mpy[p[i].first.second]++, mpy[p[i].second.second]++;
    mpp[p[i].first]++, mpp[p[i].second]++;
    m[p[i]]++;
  }
  if (m.size() != 4) return cout << "NO", 0;
  for (auto i : mpx)
    if (i.second != 4) return cout << "NO", 0;
  for (auto i : mpy)
    if (i.second != 4) return cout << "NO", 0;
  for (auto i : mpp)
    if (i.second != 2) return cout << "NO", 0;
  long long cnt = 0;
  for (int i = 0; i < 4; i++)
    for (int j = 0; j < 4; j++)
      if (p[i].first == p[j].second && p[i].second == p[j].first) {
        cnt++;
        break;
      }
  if (cnt == 4) return cout << "NO", 0;
  cout << "YES";
  return 0;
}
