#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
};
int compare2(const void *elem1, const void *elem2) {
  int x = (*(struct point *)elem1).x - (*(struct point *)elem2).x;
  if (x == 0) {
    return (*(struct point *)elem1).y - (*(struct point *)elem2).y;
  } else
    return x;
}
int compare(struct point p1, struct point p2) {
  int x = p1.x - p2.x;
  if (x == 0) {
    return p1.y - p2.y;
  } else
    return x;
}
int main() {
  int ss;
  struct point A[4][2];
  for (int i = 0; i < 4; ++i) {
    scanf("%d", &A[i][0].x);
    scanf("%d", &A[i][0].y);
    scanf("%d", &A[i][1].x);
    scanf("%d", &A[i][1].y);
    qsort(A[i], 2, sizeof(struct point), compare2);
  }
  int x[2];
  int a = 0;
  int b = 0;
  int y[2];
  int flag = 0;
  for (int i = 0; i < 4; i++) {
    if (A[i][0].x - A[i][1].x == 0 && a < 2) {
      y[a++] = i;
    } else if (A[i][0].y - A[i][1].y == 0 && b < 2) {
      x[b++] = i;
    } else {
      flag = 1;
      break;
    }
  }
  if (flag) {
    cout << "NO";
  } else {
    int check = 0;
    if (A[x[0]][0].x == A[x[1]][0].x && A[x[0]][1].x == A[x[1]][1].x) {
      if (A[y[0]][0].y == A[y[1]][0].y && A[y[0]][1].y == A[y[1]][1].y) {
        if (A[x[0]][0].y > A[x[1]][0].y) {
          int temp = x[0];
          x[0] = x[1];
          x[1] = temp;
        }
        if (A[y[0]][0].x > A[y[1]][0].x) {
          int temp = y[0];
          y[0] = y[1];
          y[1] = temp;
        }
        if (compare(A[x[1]][0], A[y[0]][1]) == 0 &&
            compare(A[x[1]][1], A[y[1]][1]) == 0 &&
            compare(A[x[0]][0], A[y[0]][0]) == 0 &&
            compare(A[x[0]][1], A[y[1]][0]) == 0)
          check = 1;
      }
    }
    if (check == 0)
      cout << "NO";
    else {
      int check2 = 1;
      if (A[x[1]][0].y == A[x[0]][0].y || A[y[1]][0].x == A[y[0]][0].x)
        cout << "NO";
      else
        cout << "YES";
    }
  }
}
