#include <bits/stdc++.h>
using namespace std;
struct line {
  pair<long long, long long> p1, p2;
  long long length;
};
int main() {
  line l[5];
  map<long long, vector<pair<long long, long long> > > match;
  long long diag1 = -1, diag2 = -1;
  for (long long i = 0; i < 4; i++) {
    cin >> l[i].p1.first >> l[i].p1.second >> l[i].p2.first >> l[i].p2.second;
    l[i].length = (abs(l[i].p1.first - l[i].p2.first) *
                   abs(l[i].p1.first - l[i].p2.first)) +
                  (abs(l[i].p1.second - l[i].p2.second) *
                   abs(l[i].p1.second - l[i].p2.second));
  }
  long long c = 0;
  bool found = true;
  for (long long i = 0; found && i < 4; i++) {
    c = 0;
    for (long long j = 0; j < 4; j++) {
      if (i == j) continue;
      if (l[i].p1.first == l[j].p1.first && l[i].p1.second == l[j].p1.second) {
        c++;
        match[i].push_back(make_pair(j, 0));
      } else if (l[i].p1.first == l[j].p2.first &&
                 l[i].p1.second == l[j].p2.second) {
        c++;
        match[i].push_back(make_pair(j, 1));
      } else if (l[i].p2.first == l[j].p1.first &&
                 l[i].p2.second == l[j].p1.second) {
        c++;
        match[i].push_back(make_pair(j, 2));
      } else if (l[i].p2.first == l[j].p2.first &&
                 l[i].p2.second == l[j].p2.second) {
        c++;
        match[i].push_back(make_pair(j, 3));
      }
    }
    if (c != 2) {
      found = false;
      break;
    }
  }
  if (found) {
    for (long long i = 0; i < 4; i++) {
      if (l[match[i][0].first].length != l[match[i][1].first].length) {
        found = false;
        break;
      }
      int axis = 0;
      if ((l[match[i][0].first].p1.first == l[match[i][0].first].p2.first) &&
          (l[match[i][1].first].p1.first == l[match[i][1].first].p2.first)) {
        axis = 1;
      } else if ((l[match[i][0].first].p1.second ==
                  l[match[i][0].first].p2.second) &&
                 (l[match[i][1].first].p1.second ==
                  l[match[i][1].first].p2.second)) {
        axis = 2;
      }
      for (long long j = 0; j < 4; j++)
        if (j != i && j != match[i][0].first && j != match[i][1].first) {
          if (l[j].length != l[i].length) {
            found = false;
            break;
          }
          if (axis == 1) {
            if (!(l[i].p1.second == l[i].p2.second &&
                  l[j].p1.second == l[j].p2.second)) {
              found = false;
              break;
            }
          } else {
            if (!(l[i].p1.first == l[i].p2.first &&
                  l[j].p1.first == l[j].p2.first)) {
              found = false;
              break;
            }
          }
        }
    }
  }
  if (found) {
    if (match[0][0].second == 0) {
      diag1 = (abs(l[0].p2.first - l[match[0][0].first].p2.first) *
               abs(l[0].p2.first - l[match[0][0].first].p2.first)) +
              (abs(l[0].p2.second - l[match[0][0].first].p2.second) *
               abs(l[0].p2.second - l[match[0][0].first].p2.second));
    } else if (match[0][0].second == 1) {
      diag1 = (abs(l[0].p2.first - l[match[0][0].first].p1.first) *
               abs(l[0].p2.first - l[match[0][0].first].p1.first)) +
              (abs(l[0].p2.second - l[match[0][0].first].p1.second) *
               abs(l[0].p2.second - l[match[0][0].first].p1.second));
    } else if (match[0][0].second == 2) {
      diag1 = (abs(l[0].p1.first - l[match[0][0].first].p2.first) *
               abs(l[0].p1.first - l[match[0][0].first].p2.first)) +
              (abs(l[0].p1.second - l[match[0][0].first].p2.second) *
               abs(l[0].p1.second - l[match[0][0].first].p2.second));
    } else if (match[0][0].second == 3) {
      diag1 = (abs(l[0].p1.first - l[match[0][0].first].p1.first) *
               abs(l[0].p1.first - l[match[0][0].first].p1.first)) +
              (abs(l[0].p1.second - l[match[0][0].first].p1.second) *
               abs(l[0].p1.second - l[match[0][0].first].p1.second));
    }
    if (match[0][1].second == 0) {
      diag2 = (abs(l[0].p2.first - l[match[0][1].first].p2.first) *
               abs(l[0].p2.first - l[match[0][1].first].p2.first)) +
              (abs(l[0].p2.second - l[match[0][1].first].p2.second) *
               abs(l[0].p2.second - l[match[0][1].first].p2.second));
    } else if (match[0][1].second == 1) {
      diag2 = (abs(l[0].p2.first - l[match[0][1].first].p1.first) *
               abs(l[0].p2.first - l[match[0][1].first].p1.first)) +
              (abs(l[0].p2.second - l[match[0][1].first].p1.second) *
               abs(l[0].p2.second - l[match[0][1].first].p1.second));
    } else if (match[0][1].second == 2) {
      diag2 = (abs(l[0].p1.first - l[match[0][1].first].p2.first) *
               abs(l[0].p1.first - l[match[0][1].first].p2.first)) +
              (abs(l[0].p1.second - l[match[0][1].first].p2.second) *
               abs(l[0].p1.second - l[match[0][1].first].p2.second));
    } else if (match[0][1].second == 3) {
      diag2 = (abs(l[0].p1.first - l[match[0][1].first].p1.first) *
               abs(l[0].p1.first - l[match[0][1].first].p1.first)) +
              (abs(l[0].p1.second - l[match[0][1].first].p1.second) *
               abs(l[0].p1.second - l[match[0][1].first].p1.second));
    }
    if (diag1 == -1 || diag2 == -1 || diag1 != diag2) found = false;
  }
  if (!found)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
