#include <bits/stdc++.h>   using namespace std;   using namespace std;   bool onSegment(pair<int, int> p, pair<int, int> q, pair<int, int> r) {     if (q.first <= max(p.first, r.first) && q.first >= min(p.first, r.first) &&         q.second <= max(p.second, r.second) &&         q.second >= min(p.second, r.second))       return true;     return false;   }   int orientation(pair<int, int> p, pair<int, int> q, pair<int, int> r) {     int val = (q.second - p.second) * (r.first - q.first) -               (q.first - p.first) * (r.second - q.second);     if (val == 0) return 0;     return (val > 0) ? 1 : 2;   }   bool intersect(pair<int, int> p1, pair<int, int> q1, pair<int, int> p2,                  pair<int, int> q2) {     int o1 = orientation(p1, q1, p2);     int o2 = orientation(p1, q1, q2);     int o3 = orientation(p2, q2, p1);     int o4 = orientation(p2, q2, q1);     if (o1 != o2 && o3 != o4) return true;     if (o1 == 0 && onSegment(p1, p2, q1)) return true;     if (o2 == 0 && onSegment(p1, q2, q1)) return true;     if (o3 == 0 && onSegment(p2, p1, q2)) return true;     if (o4 == 0 && onSegment(p2, q1, q2)) return true;     return false;   }   float area(int x1, int y1, int x2, int y2, int x3, int y3) {     return abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);   }   bool check(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4,              int x, int y) {     float A = area(x1, y1, x2, y2, x3, y3) + area(x1, y1, x4, y4, x3, y3);     float A1 = area(x, y, x1, y1, x2, y2);     float A2 = area(x, y, x2, y2, x3, y3);     float A3 = area(x, y, x3, y3, x4, y4);     float A4 = area(x, y, x1, y1, x4, y4);     return (A == A1 + A2 + A3 + A4);   }   int main() {     int a, b, c = 0, c1 = 0;     vector<pair<int, int> > v1, v2;     for (int i = 0; i < 4; i++) {       cin >> a >> b;       v1.push_back(pair<int, int>(a, b));     }     for (int i = 0; i < 4; i++) {       cin >> a >> b;       v2.push_back(pair<int, int>(a, b));     }     for (int i = 0; i < 4; i++) {       if (check(v1[0].first, v1[0].second, v1[1].first, v1[1].second, v1[2].first,                 v1[2].second, v1[3].first, v1[3].second, v2[i].first,                 v2[i].second))         c++;     }     for (int i = 0; i < 4; i++) {       if (check(v2[0].first, v2[0].second, v2[1].first, v2[1].second, v2[2].first,                 v2[2].second, v2[3].first, v2[3].second, v1[i].first,                 v1[i].second))         c1++;     }     if (c == 4 || c1 == 4) {       cout <<  YES ;     } else {       c = 0;       for (int i = 0; i < 4; i++) {         for (int j = 0; j < 4; j++) {           if (intersect(v1[i], v1[(i + 1) % 4], v2[j], v2[(j + 1) % 4])) c++;         }       }       if (c != 0)         cout <<  YES ;       else         cout <<  NO ;     }     return 0;   }   