#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int INF = 2e9+5;

/*
    filippos
    Contest : 14
    Task : C
*/

struct segment{
	pii l, r;
	bool operator< (segment &other){
		if(l == other.l)
			return r < other.r;
		return l < other.l;
	}
};

int dist (pii a, pii b){
	return abs(a.first - b.first) + abs(a.second - b.second);
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);
    vector<segment> ss(4);
    for(auto &s : ss){
    	cin >> s.l.first >> s.l.second >> s.r.first >> s.r.second;
    	if(s.l > s.r)
    		swap(s.l, s.r);
    }

    /*
		D ---- C
		|	   |
		|	   |
		A ---- B
    */
    sort(ss.begin(), ss.end());
    //they should be ordered as AD, AB, DC, BC
    // for(segment s : ss){	
    // 	cout << "(" << s.l.first << ", " << s.l.second << ") "; 
    // 	cout << "(" << s.r.first << ", " << s.r.second << ")\n"; 
    // }
    
    bool ok = 1;
    
    //we check they are fine
    if(ss[0].l != ss[1].l) ok = 0;
    if(ss[1].r != ss[3].l) ok = 0;
    if(ss[2].r != ss[3].r) ok = 0;
    if(ss[0].r != ss[2].l) ok = 0;
    
    //we check positive area
    for(segment s : ss)
    	if(dist(s.l, s.r) == 0)
    		ok = 0;

    //we check horizontal segments
    for(segment s : ss)
    	if(s.l.first != s.r.first && s.l.second != s.r.second)
    		ok = 0;

    if(ok) cout << "YES";
    else cout << "NO";
}