lines = []

for i in range(4):
    lines.append(list(map(int, input().split(" "))))

first_dots = [ i[:2]  for i in lines]
second_dots = [ i[2:4]  for i in lines]
dots = first_dots + second_dots

# print(dots)

is_line = [first_dots[dot]!=second_dots[dot] for dot in range(4)]
if sum(is_line)<4:
    print("NO")

else:
    dots_have_a_twin = []
    for dot in range(8):
        has_a_twin = []
        for i in range(8):
            has_a_twin.append(dots[dot]==dots[i])
        dots_have_a_twin.append(sum(has_a_twin))
    # print(dots_have_a_twin)
    if dots_have_a_twin != [2 for i in range(8)]:
        print("NO")
    else:
        if sum([(first_dots[dot][0]==second_dots[dot][0])|(first_dots[dot][1]==second_dots[dot][1]) for dot in range(4)])<4:
            print("NO")
        else:
            all_vertical = [dots[i][0]==dots[i+1][0] for i in range(7)]
            all_horizontal = [dots[i][1]==dots[i+1][1] for i in range(7)]
            if (sum(all_vertical)==7)|(sum(all_horizontal)==7):
                print("NO")
            else:
                print("YES")