Language: C++

#include <cstdio>
#include <vector>
#include <utility>
#include <complex>
using namespace std;

typedef std::pair<float, float> P;

float f[10];

namespace layer0 {

struct Bound {
  float mnX, mnY, mxX, mxY;
};

Bound createLhsBound() {
  const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
  return (Bound){mnX, mnY, mxX, mxY};
}

Bound createRhsBound() {
  const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];

struct Bound {
  float mnX, mnY, mxX, mxY;
};

Bound createLhsBound() {
  const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
  return (Bound){mnX, mnY, mxX, mxY};
}

Bound createRhsBound() {
  const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
  return (Bound){mnX, mnY, mxX, mxY};
}

  const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
  return (Bound){mnX, mnY, mxX, mxY};
}

Bound createRhsBound() {
  const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
  return (Bound){mnX, mnY, mxX, mxY};
}

vector<P> create(float mnX, float mnY, float mxX, float mxY) {
  vector<P> v;
  const float lx[2] = {mnX, mxX};
  const float ly[2] = {mnY, mxY};
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 2; ++j)
      v.push_back(P(lx[i], ly[j]));
  return v;
}

vector<P> createLhs() {
  const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
  return create(mnX, mnY, mxX, mxY);
}

vector<P> createRhs() {
  const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
  return create(mnX, mnY, mxX, mxY);
}

bool isLess(float l, float r) {
  if ((l - (1e-11)) < r)
    return true;
  return false;
}

int check() {
  Bound lhsBound = createLhsBound(), rhsBound = createRhsBound();
  vector<P> lhs = createLhs(), rhs = createRhs();

  for (int i = 0; i < 4; ++i) {
    P cur = lhs[i];
    if (isLess(rhsBound.mnX, cur.first) &&
        isLess(cur.first, rhsBound.mxX) &&
        isLess(rhsBound.mnY, cur.second) &&
        isLess(cur.second, rhsBound.mxY))
      return 1;
  }

  for (int i = 0; i < 4; ++i) {
    P cur = rhs[i];
    if (isLess(lhsBound.mnX, cur.first) &&
        isLess(cur.first, lhsBound.mxX) &&
        isLess(lhsBound.mnY, cur.second) &&
        isLess(cur.second, lhsBound.mxY))
      return 1;
  }
  return 0;
}

};  // namespace layer0

typedef complex<float> C;
typedef pair<C,C> PC;

namespace layer1 {

vector<PC> make(float mnX, float mnY, float mxX, float mxY) {
  vector<PC> v;
  const C LeftUp(mnX, mxY);
  const C RightUp(mxX, mxY);
  const C LeftDown(mnX, mnY);
  const C RightDown(mxX, mnY);
  // up
  v.push_back(PC(LeftUp, RightUp));
  // right
  v.push_back(PC(RightUp, RightDown));
  // down
  v.push_back(PC(LeftDown, RightDown));
  // left
  v.push_back(PC(LeftUp, LeftDown));
  return v;
}

vector<PC> makeLhs() {
  const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
  return make(mnX, mnY, mxX, mxY);
}

vector<PC> makeRhs() {
  const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
  return make(mnX, mnY, mxX, mxY);
}

float cross(C l, C r) {
  return l.real() * r.imag() - l.imag() * r.real();
}

int isIntersection(PC l, PC r) {
  C lb = l.first, le = l.second;
  C rb = r.first, re = r.second;
  return
      (cross(le - lb, rb - lb) * cross(le - lb, re - lb) < 1e-10) &&
      (cross(re - rb, lb - rb) * cross(re - rb, le - rb) < 1e-10);
}

int check() {
  vector<PC> lhs = makeLhs(), rhs = makeRhs();

  for (size_t i = 0; i < lhs.size(); ++i)
    for (size_t j = 0; j < rhs.size(); ++j)
      if (isIntersection(lhs[i], rhs[j]))
        return 1;

  return 0;
}

}; // namespace layer1

int solve() {
  return layer0::check() | layer1::check();
}

int main() {

  // printf("%d\n", layer1::isIntersection(PC(C(0, 0), C(3, 0)), PC(C(1, 1), C(1, 2))));
  // return 0;

  float check;
  while (scanf("%f", &check) != -1) {
    f[0] = check;
    for (int i = 1; i < 8; ++i)
      scanf("%f", f + i);
    printf("%s\n", solve() ? "YES" : "NO");
  }
  return 0;
}

Compiler output:
a.cc: In function 'layer0::Bound layer0::createRhsBound()':
a.cc:29:21: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   29 | Bound createLhsBound() {
      |                     ^~
a.cc:29:21: note: remove parentheses to default-initialize a variable
   29 | Bound createLhsBound() {
      |                     ^~
      |                     --
a.cc:29:21: note: or replace parentheses with braces to aggregate-initialize a variable
a.cc:29:24: error: a function-definition is not allowed here before '{' token
   29 | Bound createLhsBound() {
      |                        ^
a.cc:34:21: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   34 | Bound createRhsBound() {
      |                     ^~
a.cc:34:21: note: remove parentheses to default-initialize a variable
   34 | Bound createRhsBound() {
      |                     ^~
      |                     --
a.cc:34:21: note: or replace parentheses with braces to aggregate-initialize a variable
a.cc:34:24: error: a function-definition is not allowed here before '{' token
   34 | Bound createRhsBound() {
      |                        ^
a.cc:39:15: error: redeclaration of 'const float mnX'
   39 |   const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
      |               ^~~
a.cc:23:15: note: 'const float mnX' previously declared here
   23 |   const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
      |               ^~~
a.cc:39:27: error: redeclaration of 'const float mnY'
   39 |   const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
      |                           ^~~
a.cc:23:27: note: 'const float mnY' previously declared here
   23 |   const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
      |                           ^~~
a.cc:39:39: error: redeclaration of 'const float mxX'
   39 |   const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
      |                                       ^~~
a.cc:23:39: note: 'const float mxX' previously declared here
   23 |   const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
      |                                       ^~~
a.cc:39:51: error: redeclaration of 'const float mxY'
   39 |   const float mnX = f[0], mnY = f[1], mxX = f[2], mxY = f[3];
      |                                                   ^~~
a.cc:23:51: note: 'const float mxY' previously declared here
   23 |   const float mnX = f[4], mnY = f[5], mxX = f[6], mxY = f[7];
      |                                                   ^~~
a.cc:40:17: error: could not convert 'layer0::createRhsBound()::Bound{((float)mnX), ((float)mnY), ((float)mxX), ((float)mxY)}' from 'layer0::createRhsBound()::Bound' to 'layer0::Bound'
   40 |   return (Bound){mnX, mnY, mxX, mxY};
      |                 ^~~~~~~~~~~~~~~~~~~~
      |                 |
      |                 layer0::createRhsBound()::Bound
a.cc: At global scope:
a.cc:43:7: error: redefinition of 'layer0::Bound layer0::createRhsBound()'
   43 | Bound createRhsBound() {
      |       ^~~~~~~~~~~~~~
a.cc:22:7: note: 'layer0::Bound layer0::createRhsBound()' previously defined here
   22 | Bound createRhsBound() {
      |       ^~~~~~~~~~~~~~