/* Bissmilahir ~ Rahmanir ~ Rahim /
*********************************/

#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <limits.h>
#include <time.h>
#include <cassert>
#include <iomanip>

using namespace std;

#define PB push_back
#define MP make_pair
#define IN insert
#define all( x ) x.begin(), x.end()

int j;
__int64 i, ans = 1;
double dis[6];

set < __int64 > Y;
set < __int64 > X;
set < double > D;

int main()
{
	__int64 x1[6], x2[6], y1[6], y2[6];
	
	for (i=0; i<4; i++) {
		cin >> x1[i] >> y1[i];
		cin >> x2[i] >> y2[i];
		dis[i] = sqrt(pow(x1[i]-x2[i], 2.)+pow(y1[i]-y2[i], 2.));
		Y.IN( y1[i] ); Y.IN( y2[i] );
		X.IN( x1[i] ); X.IN( x2[i] );
		D.IN( dis[i] );
		if ( !dis[i] || dis[i] != int(dis[i]) || (x1[i] != x2[i] && y1[i] != y2[i])) {
			cout << "NO" << endl;
			exit(0);
		}
	}
	
	for (i=0; i<4; i++)
		for (j=i+1; j<4; j++)
			if ((x1[i] == x1[j] && y1[i] == y1[j] &&
				 x2[i] == x2[j] && y2[i] == y2[j]) ||
				(x2[i] == x1[j] && y2[i] == y1[j] &&
				 x1[i] == x2[j] && y1[i] == y2[j]))
				ans = 0;
	
	double k = 1;
	set < double > :: iterator it;
	for (it=D.begin(); it!=D.end(); it++)
		k *= (*it);
	
	if ( k <= 0 || k != int(k) || k != ceil(k) || k != round(k))
		ans = 0;
		
	if (Y.size() != 2 || X.size() != 2 || D.size() > 2)
		ans = 0;
	
	cout << ( ans ? "YES" : "NO" ) << endl;

return 0;
}
