#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pop pop_back()
#define sz size()
using namespace std;
typedef long long ll;
bool isPrime(ll n)
{
    if(n==1)
        return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
        return false;
    return true;
}
int lcm(ll a, ll b)
{
    int temp = __gcd(a, b);

    return temp ? (a / temp * b) : 0;
}
string al="abcdefghijklmnopqrstuvwxyz";
pair<ll,ll>p[200];
unordered_map <string,ll> mapp;
vector<ll>vi;
ll mx=-999999999999999999,mix=100000000000,my=-999999999999999999,miy=100000000000;
///////////////////////////////////////////
ll n,m,i,j,ans=-1,x,y,cnt,sum,sum1,k=1;
string s[1000],t1,t2,t3,t4;
ll a[100][100],b[4][2];
int main(){
    ios_base::sync_with_stdio(0);
    for(i=1;i<=4;i++)
    for(j=1;j<=4;j++){
        cin>>a[i][j];
    }
    for(i=1;i<=4;i++){
        for(j=1;j<=2;j++){
            if(j==1)
              p[cnt].fi=a[i][j];
            else
              p[cnt].se=a[i][j];
        }
        cnt++;
        for(j=3;j<=4;j++){
            if(j==3)
              p[cnt].fi=a[i][j];
            else
              p[cnt].se=a[i][j];
        }
        cnt++;
    }
    sort(p,p+cnt);
    for(i=0;i<cnt-1;i++){
         if(p[i].fi!=p[i+1].fi || p[i].se!=p[i+1].se)
            k++;
    }
    if(k!=4){
        cout<<"NO";
        return 0;
    }
    for(i=1;i<=4;i++){
         mx=max(mx,a[i][1]);
         mx=max(mx,a[i][3]);
         mix=min(mix,a[i][1]);
         mix=min(mix,a[i][3]);
         my=max(my,a[i][2]);
         my=max(my,a[i][4]);
         miy=min(miy,a[i][2]);
         miy=min(miy,a[i][4]);
    }
    if(mx==mix || my==miy){
        cout<<"NO";
        return 0;
    }
    b[1][1]=mix,b[1][2]=miy;
    b[2][1]=mix,b[2][2]=my;
    b[3][1]=mx,b[3][2]=miy;
    b[4][1]=mx,b[4][2]=my;
    for(i=1;i<=4;i++){
         m=0;
         for(j=0;j<cnt;j++){
            if(b[i][1]==p[j].fi && b[i][2]==p[j].se)
            m=1;
         }
        if(m==0){
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";

}





