#include <bits/stdc++.h>
using namespace std;
int n = 8;
struct point {
  int x;
  int y;
};
bool f(point a, point b) {
  if (a.x != b.x) return a.x > b.x;
  return a.y > b.y;
}
int main() {
  point a[8];
  for (int i = 0; i < n; i++) cin >> a[i].x >> a[i].y;
  int t1 = 0, t2 = 0;
  for (int i = 0; i < n; i += 2) {
    if (a[i].x == a[i + 1].x) {
      t1++;
    } else if (a[i].y == a[i + 1].y)
      t2++;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  if (t1 != 2 || t2 != 2) {
    cout << "NO" << endl;
    return 0;
  }
  int t = 0;
  sort(a, a + n, f);
  if (a[1].x == a[2].x && a[1].y == a[2].y ||
      a[3].x == a[4].x && a[3].y == a[4].y ||
      a[5].x == a[6].x && a[5].y == a[6].y) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < n; i += 2) {
    if (a[i].x == a[i + 1].x && a[i].y == a[i + 1].y)
      t++;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  if (t == 4)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
