def distance(a, b, c, d):
    return (d - b) ** 2 + (c - a) ** 2    


def slope(a, b, c, d):
    if a == c:
        return float('inf')
    else:
        return (d - b) / (c - a)

def CF14C():
    
    infinity = 0
    zero = 0
    counter = {} # Sides counter
    points = set()
    for i in range(4):
        a, b, c, d = list(map(int, input().split()))
        points.add((a, b))
        points.add((c, d))
        s = slope(a, b, c, d)
        if s == float('inf'):
            infinity += 1
        elif s == 0:
            zero += 1
        side = distance(a, b, c, d)
        counter[side] = counter.get(side, 0) + 1
    
    # There should be two sides parallel to x-axis and two sides parallel to y-axis
    if zero != 2 and infinity != 2: return False
    # print("Slopes ma problem vayena")
    
    # There should be only two values and both of them should have two elements
    if len(counter) != 2: return False
    counts = list(counter.values())
    if counts[1] != counts[0]: return False
    # print("Sides pani duita equal cha")
    
    # Lets do the pythagoras test now. Final test.
    points = sorted(list(points), key = lambda x: (x[0], x[1]))
    a, b = points[0]
    c, d = points[1]
    e, f = points[2]
    
    sides = list(counter.keys())
    d1 = distance(a, b, c, d)
    d2 = distance(b, c, d, e)
    d3 = distance(a, b, e, f)
    if sides[0] + sides[1] != max(d1, d2, d3): return False
    
    # For everything else.
    return True     
                
res = CF14C()
print(res)