#! /usr/bin/python
from sys import stdin

def parallel_x(line):
	(x1,y1,x2,y2)=line
	return y1==y2

def parallel_y(line):
	(x1,y1,x2,y2)=line
	return x1==x2

def end_points(line):
	(x1,y1,x2,y2)=line
	return ((x1,y1),(x2,y2))

def same_length(line1,line2,axis):
	(start1,end1)=end_points(line1)
	(start2,end2)=end_points(line2)
	return abs(start1[axis]-end1[axis])==abs(start2[axis]-end2[axis])

def consecutive(l1,l2):
	(start1,end1)=end_points(l1)
	(start2,end2)=end_points(l2)
	#print "start=",start2," end=",end1
	return end1==start2
	
def lines_matchup(lines):
	ret=True
	for i in xrange(len(lines)-1):
		ret=ret and consecutive(lines[i],lines[i+1])
	ret=ret and consecutive(lines[-1],lines[0])
	return ret
	
def try_matching(solution,taken,lines):
	if len(solution)==len(taken):
		return lines_matchup(solution)
	else:
		ret=False
		for i,line in enumerate(lines):
			if ret:
				break
			if not taken[i]:
				taken[i]=True
				solution.append(line)
				ret=ret or try_matching(solution,taken,lines)
				solution.pop()
				taken[i]=False
		return ret

def sqr(lines):
	counts={}
	for line in lines:
		(p1,p2)=end_points(line)
		if p1 not in counts:
			counts[p1]=0
		if p2 not in counts:
			counts[p2]=0
		counts[p1]+=1
		counts[p2]+=1
	return len(counts)==4 and all([counts[x]==2 for x in counts]) 
def makes_rect(lines):
	p_x=[line for line in lines if parallel_x(line)]
	p_y=[line for line in lines if parallel_y(line)]
	if len(p_x)!=2 or len(p_y)!=2:
		return False
	if not(same_length(p_x[0],p_x[1],0)) or not(same_length(p_y[0],p_y[1],1)):
		return False
	
	return sqr(lines)
	
def normalize(line):
	(e1,e2)=end_points(line)
	if e2>e1:
		(e1,e2)=(e2,e1)
	return (e1[0],e1[1],e2[0],e2[1])
if __name__=='__main__':
	lines=[map(int,stdin.readline().split()) for i in xrange(4)]
	if makes_rect(lines):
		print "YES"
	else:
		print "NO"
