#include <bits/stdc++.h>
using namespace std;
const int N = 5;
int a[N][N], b[N][2];
int main() {
  int i, j, m = 0, s = 0, x1 = 1e9, y1 = 1e9, x2 = -1 * 1e9, y2 = -1 * 1e9,
            x = 0, y = 0, x0 = 0, y0 = 0;
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < 4; i++) {
    s = 0;
    for (j = 0; j < m; j++) {
      if (b[j][0] == a[i][0] && b[j][1] == a[i][1]) {
        s++;
      }
    }
    if (s == 0) {
      b[m][0] = a[i][0];
      b[m][1] = a[i][1];
      m++;
    }
    s = 0;
    for (j = 0; j < m; j++) {
      if (b[j][0] == a[i][2] && b[j][1] == a[i][3]) {
        s++;
      }
    }
    if (s == 0) {
      b[m][0] = a[i][2];
      b[m][1] = a[i][3];
      m++;
    }
  }
  if (m != 4) {
    cout << "NO" << endl;
    return 0;
  }
  for (i = 0; i < m; i++) {
    x1 = min(x1, b[i][0]);
    x2 = max(x2, b[i][0]);
    y1 = min(y1, b[i][1]);
    y2 = max(y2, b[i][1]);
  }
  if (x1 == x2 || y1 == y2) {
    cout << "NO" << endl;
    return 0;
  }
  s = 0;
  for (i = 0; i < 4; i++) {
    if (!x && (a[i][0] == x1 && a[i][1] == y1 && a[i][2] == x1 &&
               a[i][3] == y2) ||
        !x && (a[i][0] == x1 && a[i][1] == y2 && a[i][2] == x1 &&
               a[i][3] == y1)) {
      x++;
      s++;
    }
    if (!y && (a[i][0] == x2 && a[i][1] == y1 && a[i][2] == x1 &&
               a[i][3] == y1) ||
        !y && (a[i][0] == x1 && a[i][1] == y1 && a[i][2] == x2 &&
               a[i][3] == y1)) {
      y++;
      s++;
    }
    if (!x0 && (a[i][0] == x1 && a[i][1] == y2 && a[i][2] == x2 &&
                a[i][3] == y2) ||
        !x0 && (a[i][0] == x2 && a[i][1] == y2 && a[i][2] == x1 &&
                a[i][3] == y2)) {
      x0++;
      s++;
    }
    if (!y0 && (a[i][0] == x2 && a[i][1] == y1 && a[i][2] == x2 &&
                a[i][3] == y2) ||
        !y0 && (a[i][0] == x2 && a[i][1] == y2 && a[i][2] == x2 &&
                a[i][3] == y1)) {
      y0++;
      s++;
    }
  }
  if (s == 4) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
