#include<bits/stdc++.h>
using namespace std;

struct point {
    double x, y;
    point(double A, double B) {
        x = A, y = B;
    }
    point() = default;
};

struct line {
    point point_A, point_B;
    line(point A, point B) {
        point_A = A, point_B = B;
    }
    line() = default;
};

point findMeetingPoint(line line_A, line line_B) {
    // TODO:求直线 line_A 与 line_B 的交点
    //1.y=k*x-b,考虑有直线垂直于x轴(x=??)的情况。
    //2.考虑两直线平行(-1,-1)
    point A = line_A.point_A, B = line_A.point_B,
          C = line_B.point_A, D = line_B.point_B;
    point point_C;
    double k1, k2,b1,b2;
    cout << fixed << setprecision(6);//输出10-6
    if (A.x == B.x) { //line_A垂直90°无k1
        point_C.x = A.x;
        if(C.x != D.x){
             k2 = (C.y - D.y) / (C.x - D.x);
             b2 = (k2 * C.x) - C.y;
            point_C.y = k2*A.x-b2;
        }
        else{//都垂直90°无k1\k2
            point_C.x = -1;
            point_C.y = -1;
        }
        return point_C;
    }else {//正常
         k1 = (A.y - B.y) / (A.x - B.x);
         b1 = (k1 * A.x) - A.y;
    }

    if (C.x == D.x) {//line_B垂直90°无k2
        point_C.x = C.x;
        point_C.y =k1*C.x-b1;
        return point_C;
    }
    else{
         k2 = (C.y - D.y) / (C.x - D.x);
         b2 = (k2 * C.x) - C.y;
    }
//考虑两直线平行
    if (k1 == k2) {
        point_C.x = -1;
        point_C.y = -1;
        return point_C;
    }
//排除平行、垂直X轴情况
    point_C.x = (-b1 + b2) / (k2 - k1);
    point_C.y = k1 * point_C.x - b1;
  
    return  point_C;
}


































































































































































int main() {
    point A, B, C, D;
    cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> D.x >> D.y;
    line AB = line(A, B);
    line CD = line(C, D);
    point ans = findMeetingPoint(AB, CD);
    cout << ans.x << " " << ans.y;
    return 0;
}