#include <bits/stdc++.h>
using namespace std;
struct Point {
long long x, y;
};
// Function to find orientation of ordered triplet (p, q, r)
// Returns:
// 0 --> Colinear
// 1 --> Clockwise
// 2 --> Counterclockwise
int orientation(const Point& p, const Point& q, const Point& r){
long long val = (q.y - p.y)*(r.x - q.x) - (q.x - p.x)*(r.y - q.y);
if(val == 0) return 0; // Colinear
return (val > 0)? 1: 2; // Clock or Counter
}
// Function to check if point q lies on segment pr
bool on_segment(const Point& p, const Point& q, const Point& r){
if(q.x <= max(p.x, r.x) && q.x >= min(p.x, r.x) &&
q.y <= max(p.y, r.y) && q.y >= min(p.y, r.y))
return true;
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
Point p1, p2, p3, p4;
cin >> p1.x >> p1.y >> p2.x >> p2.y;
cin >> p3.x >> p3.y >> p4.x >> p4.y;
// Find the four orientations
int o1 = orientation(p1, p2, p3);
int o2 = orientation(p1, p2, p4);
int o3 = orientation(p3, p4, p1);
int o4 = orientation(p3, p4, p2);
bool intersect = false;
// General case
if(o1 != o2 && o3 != o4){
intersect = true;
}
else{
// Special Cases
// p1, p2 and p3 are colinear and p3 lies on segment p1p2
if(o1 == 0 && on_segment(p1, p3, p2)) intersect = true;
// p1, p2 and p4 are colinear and p4 lies on segment p1p2
if(o2 == 0 && on_segment(p1, p4, p2)) intersect = true;
// p3, p4 and p1 are colinear and p1 lies on segment p3p4
if(o3 == 0 && on_segment(p3, p1, p4)) intersect = true;
// p3, p4 and p2 are colinear and p2 lies on segment p3p4
if(o4 == 0 && on_segment(p3, p2, p4)) intersect = true;
}
cout << (intersect ? "YES" : "NO");
}