Олимпиадный тренинг

Задача 38662. Intersection of segments


Input
Eight numbers – coordinates of the ends of two segments.

Imprint
One line “YES” if the segments have common points, and “NO” otherwise.
 
Examples
# Input Output
1 1 2 1 2
1 2 1 2
YES
2 3 3 5 6
5 6 3 3
YES