#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, pair<int, int> > m;
int mark[10];
int main() {
  int x1[10], y1[10], x2[10], y2[10];
  cin >> x1[1] >> y1[1] >> x2[1] >> y2[1];
  cin >> x1[2] >> y1[2] >> x2[2] >> y2[2];
  cin >> x1[3] >> y1[3] >> x2[3] >> y2[3];
  cin >> x1[4] >> y1[4] >> x2[4] >> y2[4];
  for (int i = 1; i < 4; i++)
    for (int j = i + 1; j <= 4; j++)
      if ((x1[i] == x1[j] && y1[i] == y1[j] && x2[i] == x2[j] &&
           y2[i] == y2[j]) ||
          (x2[i] == x1[j] && y2[i] == y1[j] && x1[i] == x2[j] &&
           y1[i] == y2[j])) {
        cerr << "Equal segments";
        cout << "NO";
        return 0;
      }
  m[make_pair(x1[1], y1[1])] = make_pair(x2[1], y2[1]);
  m[make_pair(x1[2], y1[2])] = make_pair(x2[2], y2[2]);
  m[make_pair(x1[3], y1[3])] = make_pair(x2[3], y2[3]);
  m[make_pair(x1[4], y1[4])] = make_pair(x2[4], y2[4]);
  m[make_pair(x2[1], y2[1])] = make_pair(x1[1], y2[1]);
  m[make_pair(x2[2], y2[2])] = make_pair(x1[2], y2[2]);
  m[make_pair(x2[3], y2[3])] = make_pair(x1[3], y2[3]);
  m[make_pair(x2[4], y2[4])] = make_pair(x1[4], y2[4]);
  vector<int> ver, hor;
  for (int i = 1; i <= 4; i++) {
    if (x1[i] == x2[i]) {
      ver.push_back(i);
      mark[i]++;
    }
    if (y1[i] == y2[i]) {
      hor.push_back(i);
      mark[i]++;
    }
  }
  for (int i = 1; i <= 4; i++)
    if (mark[i] != 1) {
      cout << "NO";
      return 0;
    }
  if (ver.size() != 2 || hor.size() != 2) {
    cout << "NO";
    cerr << "Not Parallel to X or Y";
    return 0;
  }
  if (m.size() != 4) {
    cout << "NO";
    cerr << "Too Many Points in Map";
    return 0;
  }
  cerr << "Ok";
  cout << "YES";
}
