#include <bits/stdc++.h>   using namespace std;   using ll = unsigned long long;   ll a[5], b[5], c[5], d[5], fl, k, cnt, vis[10];   set<pair<ll, ll> > st;   map<pair<ll, ll>, ll> mp;   vector<ll> G[10];   set<ll> stt;   void dfs(ll u = 1, ll par = -1) {     vis[u] = 1;     cnt++;     for (ll v : G[u]) {       if (par == v) continue;       if (vis[v]) return;       dfs(v, u);     }   }   int main() {     while (cin >> a[0] >> b[0] >> c[0] >> d[0]) {       st.clear();       stt.clear();       for (int i = 1; i < 4; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];       fl = 1;       for (int i = 0; i < 4; i++) {         if (a[i] != c[i] && b[i] != d[i]) fl = 0;       }       k = 0;       for (int i = 0; i < 10; i++) G[i].clear();       for (int i = 0; i < 10; i++) vis[i] = 0;       for (int i = 0; i < 4; i++) {         if (mp.find({a[i], b[i]}) == mp.end()) {           mp[{a[i], b[i]}] = ++k;         }         if (mp.find({c[i], d[i]}) == mp.end()) {           mp[{c[i], d[i]}] = ++k;         }         st.insert({a[i], b[i]});         st.insert({c[i], d[i]});         G[mp[{a[i], b[i]}]].push_back(mp[{c[i], d[i]}]);         G[mp[{c[i], d[i]}]].push_back(mp[{a[i], b[i]}]);       }       if (st.size() != 4) fl = 0;       for (int i = 0; i < 4; i++) {         stt.insert((a[i] - c[i]) * (a[i] - c[i]) + (b[i] - d[i]) * (b[i] - d[i]));       }       if (stt.size() > 2) fl = 0;       cnt = 0;       dfs();       if (cnt != 4) fl = 0;       puts(fl ?  YES  :  NO );     }   }   