class Point:
    def __init__(self, x=0.0, y=0.0):
        self.x = x
        self.y = y


class Line:
    def __init__(self, point_a=None, point_b=None):
        self.point_A = point_a if point_a is not None else Point()
        self.point_B = point_b if point_b is not None else Point()


def find_meeting_point(line_A, line_B):
    # TODO: 在这里输入你的代码,求直线 line_A 与 line_B 的交点
    # 先求两条直线的点斜式方程,再解方程组
    xa,ya, xb,yb = line_A.point_A.x,line_A.point_A.y, line_A.point_B.x,line_A.point_B.y
    xc,yc, xd,yd = line_B.point_A.x,line_B.point_A.y, line_B.point_B.x,line_B.point_B.y
    if  xa == xb and xc==xd : #两条直线都垂直于x轴,无斜率
        return Point(-1, -1)
    
    elif xa == xb :            #其中一条直线垂直于X轴
        k_cd = (yd-yc)/(xd-xc)
        C_cd = yc - k_cd * xc
        res_y = k_cd * xa + C_cd
        return Point(xa,res_y)
    
    elif xc == xd :              #其中一条直线垂直于X轴
        k_ab = (yb-ya)/(xb-xa)
        C_ab = ya - k_ab * xa 
        res_y = k_ab * xc + C_ab
        return Point(xc,res_y)

    else:                       #两条直线都不垂直于X轴,y = k * x + C
        k_ab = (yb-ya)/(xb-xa)
        C_ab = ya - k_ab * xa 
        k_cd = (yd-yc)/(xd-xc)
        C_cd = yc - k_cd * xc
        #解方程组
        if k_ab == k_cd : #两条直线平行
            return Point(-1,-1)
        else:
            res_x = (C_cd - C_ab) / (k_ab - k_cd)
            res_y = k_ab * res_x + C_ab
            return Point(res_x,res_y)

def main():
    data = list(map(float, input().split()))
    data.extend(list(map(float, input().split())))
    A = Point(data[0], data[1])
    B = Point(data[2], data[3])
    C = Point(data[4], data[5])
    D = Point(data[6], data[7])
    AB = Line(A, B)
    CD = Line(C, D)
    ans = find_meeting_point(AB, CD)
    print(f"{ans.x} {ans.y}")


if __name__ == "__main__":
    main()