#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  Point(){};
  Point(int x, int y) : x(x), y(y){};
  Point(const Point& b) : x(b.x), y(b.y){};
  ~Point(){};
  friend bool operator==(const Point& a, const Point& b) {
    return a.x == b.x && a.y == b.y;
  }
  friend bool operator!=(const Point& a, const Point& b) { return !(a == b); }
  friend bool operator<(const Point& a, const Point& b) {
    if (a.x != b.x) return a.x < b.x;
    return a.y < b.y;
  }
  friend istream& operator>>(istream& ss, Point& a) {
    ss >> a.x >> a.y;
    return ss;
  }
};
int main() {
  vector<pair<Point, Point> > mas(4);
  vector<int> cnt(2);
  for (int i = 0; i < (4); ++i) {
    Point a, b;
    cin >> a >> b;
    if (a.x != b.x && a.y != b.y || a.x == b.x && a.y == b.y) {
      cout << "NO" << endl;
      return 0;
    }
    if (b < a) swap(a, b);
    if (a.x == b.x)
      cnt[0]++;
    else
      cnt[1]++;
    mas[i] = make_pair(a, b);
  }
  if (cnt[0] != cnt[1]) {
    cout << "NO" << endl;
    return 0;
  }
  sort(mas.begin(), mas.end());
  bool found = false;
  for (int i = 0; i < (4); ++i) {
    if (mas[i] == mas[(i + 1) % 4]) {
      found = true;
      break;
    }
  }
  swap(mas[1].first, mas[1].second);
  swap(mas[3].first, mas[3].second);
  if (!found && mas[0].second == mas[2].first &&
      mas[2].second == mas[3].first && mas[3].second == mas[1].first &&
      mas[1].second == mas[0].first)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
