import sys
from math import dist


def get_ints(): return list(map(int, sys.stdin.readline().strip().split()))

l = list()
for _ in range(4):
    nl = (get_ints())
    l.append(nl[:2])
    l.append(nl[2:])

done = False
longs = list()
tp = list()
for i in range(0, 8, 2):
    if l.count(l[i]) == 2 and l.count(l[i + 1]) == 2:
        longs.append(int(dist(l[i], l[i + 1])))
        if l[i] == l[0]:
            tp.append([l[i], l[i + 1]])
    else:
        print('NO')
        done = True
        break

if not done:
    for j in range(len(longs)):
        if longs.count(longs[j]) != 2:
            print('NO')
            done = True
            break

if not done:
    if ((tp[0][1][0] - tp[0][0][0]) * (tp[1][1][0] - tp[1][0][0])) + ((tp[0][1][1] - tp[0][0][1]) * (tp[1][1][1] - tp[1][0][1]))  == 0:
        print('YES')
    else:
        print('NO')
		 	  		 	  	  	  			  		 	   	