#include <bits/stdc++.h>
using namespace std;
vector<int> parents, ranks, emp[111];
int find_set(int x) {
  if (parents[x] == x) return x;
  return parents[x] = find_set(parents[x]);
}
bool Union(int x, int y) {
  x = find_set(x), y = find_set(y);
  if (x == y) return false;
  if (ranks[x] > ranks[y]) swap(x, y);
  parents[x] = y;
  if (ranks[x] == ranks[y]) ranks[y]++;
  return true;
}
int x, x2, y, y2;
map<pair<pair<int, int>, pair<int, int> >, bool> connect;
map<pair<int, int>, int> second;
int x_mx = -1e9 - 3, y_mx = -1e9 - 3, x_min = 1e9 + 3, y_min = 1e9 + 3, n;
int main() {
  bool flag = true;
  for (int i = 0; i < 4; ++i) {
    cin >> x >> y >> x2 >> y2;
    x_mx = max(x_mx, max(x, x2));
    y_mx = max(y_mx, max(y, y2));
    y_min = min(y_min, min(y, y2));
    x_min = min(x_min, min(x, x2));
    pair<int, int> a = make_pair(x, y), b = make_pair(x2, y2);
    connect[make_pair(a, b)] = 1;
    connect[make_pair(b, a)] = 1;
    if (!second[a]) n++;
    if (!second[b]) n++;
    second[a] = 1;
    second[b] = 1;
  }
  if (n != 4) return puts("NO");
  if (y_mx == y_min || x_mx == x_min) return puts("NO");
  pair<int, int> a = make_pair(x_mx, y_mx), b = make_pair(x_min, y_min),
                 c = make_pair(x_min, y_mx), d = make_pair(x_mx, y_min);
  if (connect[make_pair(b, c)] && connect[make_pair(b, d)] &&
      connect[make_pair(a, d)] && connect[make_pair(a, c)])
    return puts("YES");
  cout << "NO";
}
