from itertools import product

def main():	
	points = list()

	for i in range(0,4):
		x1,y1,x2,y2 = map(int,raw_input().split())
		points.append((x1,y1))
		points.append((x2,y2))

	points_set = set(points)

	if len(points_set)!=4:
		return 'NO'
	points_set=list(points_set)
	xmin=min(x[0] for x in points_set)
	xmax=max(x[0] for x in points_set)
	ymin=min(x[1] for x in points_set)
	ymax=max(x[1] for x in points_set)

	for x in product([xmin,xmax],[ymin,ymax]):
		if x not in points_set:
			return 'NO'

	return 'YES'

print main()