import java.util.*;
class Main{
Scanner scan
= new Scanner
(System.
in); double Ua, Ub, numerator_a, numerator_b, denominator;
double x1 = scan.nextDouble();
double y1 = scan.nextDouble();
double x2 = scan.nextDouble();
double y2 = scan.nextDouble();
double x3 = scan.nextDouble();
double y3 = scan.nextDouble();
double x4 = scan.nextDouble();
double y4 = scan.nextDouble();
denominator=(y4-y3)*(x1-x2)-(x4-x3)*(y1-y2);
if (denominator == 0){
if ( (x1
*y2
-x2
*y1
)*(x4
-x3
) - (x3
*y4
-x4
*y3
)*(x2
-x1
) == 0 && (x1
*y2
-x2
*y1
)*(y4
-y3
) - (x3
*y4
-x4
*y3
)*(y2
-y1
) == 0) System.
out.
print("Отрезки пересекаются"); else System.
out.
print("Отрезки не пересекаются"); }
else{
numerator_a=(x4-x2)*(y4-y3)-(x4-x3)*(y4-y2);
numerator_b=(x1-x2)*(y4-y2)-(x4-x2)*(y1-y2);
Ua=numerator_a/denominator;
Ub=numerator_b/denominator;
if (Ua
>=0 && Ua
<=1 && Ub
>=0 && Ub
<=1) System.
out.
print("Отрезки пересекаются"); else System.
out.
print("Отрезки не пересекаются"); }
}
}
aW1wb3J0IGphdmEudXRpbC4qOwogCmNsYXNzIE1haW57CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb257CgkJU2Nhbm5lciBzY2FuID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlkb3VibGUgVWEsIFViLCBudW1lcmF0b3JfYSwgbnVtZXJhdG9yX2IsIGRlbm9taW5hdG9yOwoJCWRvdWJsZSB4MSA9IHNjYW4ubmV4dERvdWJsZSgpOwoJCWRvdWJsZSB5MSA9IHNjYW4ubmV4dERvdWJsZSgpOwoJCWRvdWJsZSB4MiA9IHNjYW4ubmV4dERvdWJsZSgpOwoJCWRvdWJsZSB5MiA9IHNjYW4ubmV4dERvdWJsZSgpOwoJCWRvdWJsZSB4MyA9IHN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