func_code_string: #include <bits/stdc++.h>   using namespace std;   void OUT_TST(string s, istream_iterator<string> it) { cerr << s; }   template <typename T, typename... Args>   void OUT_TST(string s, istream_iterator<string> it, T a, Args... args) {     cerr << *it <<  =  << a <<    ;     OUT_TST(s, ++it, args...);   }   template <class T>   void rd(T &ret) {     ret = 0;     bool ok = 0, u = 0;     for (;;) {       int c = getchar();       if (c >=  0  && c <=  9 )         ret = (ret << 3) + (ret << 1) + c -  0 , ok = 1;       else if (c ==  - )         u = 1;       else if (ok) {         if (u) ret *= -1;         return;       }     }   }   long long powmod(long long p, long long n, long long mod) {     long long ret = 1;     for (; n; n >>= 1) {       if (n & 1) ret = ret * p % mod;       p = p * p % mod;     }     return ret;   }   template <class T>   bool chmin(T &a, const T &b) {     return b < a ? a = b, 1 : 0;   }   template <class T>   bool chmax(T &a, const T &b) {     return b > a ? a = b, 1 : 0;   }   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   bool ok(vector<pair<int, int> > &bn, vector<int> &pos, bool tmp) {     vector<pair<int, int> > an(4);     for (int i = (0); i < (4); i++) an[i] = bn[pos[i]];     if (tmp == 1) {       if (an[0].first != an[2].first) return 0;       if (an[0].second >= an[2].second) return 0;       if (an[1].second != an[3].second) return 0;       if (an[1].first <= an[3].first) return 0;       return 1;     }     return 1;     if (an[0].first != an[3].first) return 0;     if (an[0].second >= an[3].second) return 0;     if (an[1].second >= an[2].second) return 0;     return 1;   }   vector<pair<int, int> > gao(vector<pair<int, int> > an, bool tmp) {     vector<int> pos;     for (int i = (0); i < (4); i++) pos.push_back(i);     bool fg = 0;     if (ok(an, pos, tmp)) fg = 1;     while (!fg && next_permutation((pos).begin(), (pos).end())) {       if (ok(an, pos, tmp)) {         assert(fg == 0);         fg = 1;       }     }     vector<pair<int, int> > cn(4);     for (int i = (0); i < (4); i++) cn[i] = an[pos[i]];     return cn;   }   vector<pair<int, int> > an, bn;   int xlow, ylow, xup, yup;   bool ins(int first, int second) {     if (first >= xlow && first <= xup && second >= ylow && second <= yup)       return 1;     return 0;   }   int main() {     pair<int, int> t;     for (int i = (0); i < (4); i++) {       scanf( %d%d , &t.first, &t.second);       an.push_back(t);     }     for (int i = (0); i < (4); i++) {       scanf( %d%d , &t.first, &t.second);       bn.push_back(t);     }     an = gao(an, 0);     bn = gao(bn, 1);     xlow = INT_MAX, ylow = INT_MAX, xup = -INT_MAX, yup = -INT_MAX;     for (int i = (0); i < (4); i++) {       chmin(xlow, an[i].first);       chmax(xup, an[i].first);       chmin(ylow, an[i].second);       chmax(yup, an[i].second);     }     for (int i = (0); i < (4); i++) {       string _s =  an[i].x, an[i].y ;       replace(_s.begin(), _s.end(),  , ,    );       stringstream _ss(_s);       istream_iterator<string> _it(_ss);       OUT_TST(  , _it, an[i].first, an[i].second);     };     puts(  );     for (int i = (0); i < (4); i++) {       string _s =  bn[i].x, bn[i].y ;       replace(_s.begin(), _s.end(),  , ,    );       stringstream _ss(_s);       istream_iterator<string> _it(_ss);       OUT_TST(  , _it, bn[i].first, bn[i].second);     };     puts(  );     int l = bn[1].second, r = bn[1].second;     for (int i = (bn[3].first); i < (bn[1].first + 1); i++) {       for (int j = (l); j < (r + 1); j++)         if (ins(i, j)) {           puts( YES );           return 0;         }       if (i < bn[0].first)         --l, ++r;       else         ++l, --r;     }     puts( NO );     return 0;   }   