#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y;
} le[10];
int find(int now) {
  for (int i = now + 1; i < 8; ++i) {
    if (le[i].x == le[now].x && le[i].y == le[now].y) {
      return i;
    }
  }
  return -1;
}
string slove(int now) {
  int nt = (now + 2) % 8;
  if (le[now].x != le[now + 1].x && le[now].y != le[now + 1].y) return "NO";
  if (le[nt].x != le[nt + 1].x && le[nt].y != le[nt + 1].y) return "NO";
  if (le[now].x == le[now + 1].x && le[nt].x == le[nt + 1].x) return "NO";
  if (le[now].y == le[now + 1].y && le[nt].y == le[nt + 1].y) return "NO";
  return "YES";
}
void swap(int id) {
  swap(le[id - 1].x, le[id].x);
  swap(le[id - 1].y, le[id].y);
}
void swapl(int id, int i) {
  swap(le[id].x, le[i].x);
  swap(le[id].y, le[i].y);
  swap(le[id + 1].x, le[i + 1].x);
  swap(le[id + 1].y, le[i + 1].y);
}
int main() {
  for (int i = 0; i < 8; ++i) cin >> le[i].x >> le[i].y;
  int id = find(1);
  if (id == -1) {
    cout << "NO" << endl;
    return 0;
  }
  if (id % 2 != 0) swap(id), id--;
  if (id > 2) swapl(id, 2);
  id = find(3);
  if (id == -1) {
    cout << "NO" << endl;
    return 0;
  }
  if (id % 2 != 0) swap(id), id--;
  if (id != 4) swapl(id, 4);
  id = find(5);
  if (id == -1) {
    cout << "NO" << endl;
    return 0;
  }
  if (id % 2 != 0) swap(id), id--;
  if (le[id + 1].x != le[0].x || le[id + 1].y != le[0].y) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < 8; i += 2) {
    string tt = slove(i);
    if (tt == "NO") {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
