You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect.

The interior of the square is considered to be part of the square, i.e. if one square is completely inside another, they intersect. If the two squares only share one common point, they are also considered to intersect.

Input

The input data consists of two lines, one for each square, both containing 4 pairs of integers. Each pair represents coordinates of one vertex of the square. Coordinates within each line are either in clockwise or counterclockwise order.

The first line contains the coordinates of the square with sides parallel to the coordinate axes, the second line contains the coordinates of the square at 45 degrees.

All the values are integer and between -100 and 100.

Output

Print "Yes" if squares intersect, otherwise print "No".

You can print each letter in any case (upper or lower).

Examples

Input

0 0 6 0 6 6 0 6
1 3 3 5 5 3 3 1


Output

YES


Input

0 0 6 0 6 6 0 6
7 3 9 5 11 3 9 1


Output

NO


Input

6 0 6 6 0 6 0 0
7 4 4 7 7 10 10 7


Output

YES

Note

In the first example the second square lies entirely within the first square, so they do intersect.

In the second sample squares do not have any points in common.

Here are images corresponding to the samples:

<image> <image> <image>
#include <bits/stdc++.h>
using namespace std;
long double eps = 0.0000001;
long double pi = 3.141592;
struct point {
  long double x, y;
  point() { x = y = 0; }
  point(long double a, long double b) {
    x = a;
    y = b;
  }
  bool operator==(const point &p) const {
    return (fabs(x - p.x) < eps && fabs(y - p.y) < eps);
  }
  long double polar() { return atan2(y, x); }
  void read() { cin >> x >> y; }
  void write() { cout << x << " " << y << " "; }
};
struct vect {
  long double x, y;
  vect() { x = y = 0; }
  vect(point a, point b) {
    x = b.x - a.x;
    y = b.y - a.y;
  }
  vect(long double a, long double b) {
    x = a;
    y = b;
  }
  bool operator==(const vect &p) const {
    return (fabs(x - p.x) < eps && fabs(y - p.y) < eps);
  }
  vect operator+(const vect &v) {
    vect ans;
    ans.x = x + v.x;
    ans.y = y + v.y;
    return ans;
  }
  long double operator*(const vect &v) const { return x * v.x + y * v.y; }
  long double operator^(const vect &v) const { return x * v.y - y * v.x; }
  vect operator*(const long double &k) const {
    vect v;
    v.x = x * k;
    v.y = y * k;
    return v;
  }
  long double leng() { return sqrt(x * x + y * y); }
  vect contr() {
    vect v;
    v.x = -y;
    v.y = x;
    return v;
  }
  void read() { cin >> x >> y; }
  void read_vect_point() {
    point p1, p2;
    p1.read();
    p2.read();
    x = p2.x - p1.x;
    y = p2.y - p1.y;
  }
  void write() { cout << x << " " << y << " "; }
};
struct line {
  long double a, b, c;
  line() { a = b = c = 0; }
  line(point p, vect v) {
    a = -v.y;
    b = v.x;
    c = v.y * p.x - v.x * p.y;
  }
  line(long double x, long double y, long double z) {
    a = x;
    b = y;
    c = z;
  }
  bool operator==(const line &l) const {
    return (fabs(a - l.a) < eps && fabs(b - l.b) < eps && fabs(c - l.c) < eps);
  }
  vect napr() {
    vect v;
    v.x = -b;
    v.y = a;
    return v;
  }
  vect norm() {
    vect v;
    v.x = a;
    v.y = b;
    return v;
  }
  bool is(point p) { return (fabs(a * p.x + b * p.y + c) < eps); }
  long double height(point p) {
    return fabs(p.x * a + p.y * b + c) / sqrt(a * a + b * b);
  }
  long double f(point p) { return (a * p.x + b * p.y + c); }
  void read() { cin >> a >> b >> c; }
  void write() { cout << a << " " << b << " " << c << " "; }
  point rand_point() {
    point p;
    p.x = -(c * a) / (a * a + b * b);
    p.y = -(c * b) / (a * a + b * b);
    return p;
  }
};
struct circle {
  point p;
  long double r;
  circle() {
    p = point(0, 0);
    r = 0;
  }
  circle(point x, long double t) {
    p = x;
    r = t;
  }
  bool operator==(const circle &l) const {
    return (p == l.p && fabs(r - l.r) < eps);
  }
  long double sqr(long double a) { return (a * r * r) / 2; }
  bool check_good() { return r > eps; }
  long double len(long double a) { return a * r; }
  long double degree(point c) {
    long double len = (c.x - p.x) * (c.x - p.x) + (c.y - p.y) * (c.y - p.y);
    return len - r * r;
  }
  bool in(point t) {
    vect v = vect(p, t);
    return (v.leng() < r + eps);
  }
  int pos(point t) {
    long double d = degree(t);
    if (fabs(d) < eps) return 1;
    if (d < 0) return 0;
    return 2;
  }
  void read() {
    p.read();
    cin >> r;
  }
  void write() {
    p.write();
    cout << r << " ";
  }
};
bool cmp_polar(point p1, point p2) {
  vect v1 = vect(point(0, 0), p1);
  vect v2 = vect(point(0, 0), p2);
  if (fabs((v1 ^ v2)) > eps)
    return 0 < (v1 ^ v2);
  else
    return (v1 * v1) < (v2 * v2);
}
struct polygon {
  int n;
  vector<point> p;
  polygon() { n = 0; }
  polygon(vector<point> v) {
    p = v;
    n = v.size();
  }
  long double square() {
    vector<vect> v;
    for (int i = 0; i < n; i++) v.push_back(vect(point(0, 0), p[i]));
    long double ans = 0;
    for (int i = 0; i < n - 1; i++) ans += v[i] ^ v[i + 1];
    ans += v[n - 1] ^ v[0];
    ans /= 2;
    return fabs(ans);
  }
  long double length() {
    long double ans = 0;
    for (int i = 0; i < n - 1; i++) ans += vect(p[i], p[i + 1]).leng();
    ans += vect(p[n - 1], p[0]).leng();
    return ans;
  }
  void go(vect v) {
    for (int i = 0; i < n; i++) p[i].x += v.x, p[i].y += v.y;
  }
  long double dist(point r) {
    long double ans = -1;
    for (int i = 0; i < n; i++) ans = max(ans, vect(r, p[i]).leng());
    return ans;
  }
  polygon convex_hull() {
    point to = p[0];
    for (int i = 0; i < n; i++)
      if (p[i].y < to.y || (fabs(p[i].y - to.y) < eps && p[i].x < to.x))
        to = p[i];
    go(vect(to, point(0, 0)));
    sort(p.begin(), p.end(), cmp_polar);
    vector<point> s;
    s.push_back(p[0]);
    s.push_back(p[1]);
    for (int i = 2; i < n; i++) {
      while (s.size() > 1 && (vect(s[s.size() - 2], s[s.size() - 1]) ^
                              vect(s[s.size() - 2], p[i])) < 0)
        s.pop_back();
      s.push_back(p[i]);
    }
    polygon r = polygon(s);
    r.go(vect(point(0, 0), to));
    return r;
  }
  void read() {
    cin >> n;
    p.resize(n);
    for (int i = 0; i < n; i++) p[i].read();
  }
  void write() {
    cout << n << endl;
    for (int i = 0; i < n; i++) {
      p[i].write();
      cout << endl;
    }
  }
};
long double deg_to_rad(long double a);
long double rad_to_deg(long double a);
point read_point_polar();
vect radius_v(point p);
long double polar_angle(point p);
point point_napr(long double a);
long double angle_vect(vect a, vect b);
long double length(point p1, point p2);
line line_point(point p1, point p2);
point go(point p, vect v);
line go_line(line l, vect v);
vect do_len(long double len, vect v);
bool cmp_polar(point p1, point p2);
bool is_in_luch(point p1, point vn, point vk);
bool is_in_one_side(line l, point p1, point p2);
bool is_in_otr(point p, point vn, point vk);
long double dist_to_otr(point p, point vn, point vk);
int kol_intersec_line_line(line l1, line l2);
point intersection_line_line(line l1, line l2);
line centr_perp(point p1, point p2);
point otnosh(point a, point b, long double m, long double n);
line biss(point a, point b, point c);
line median(point a, point b, point c);
line heig(point p, line l);
point perp(point p, line l);
point simm(point p, line l);
circle in_circle(point a, point b, point c);
circle out_circle(point a, point b, point c);
int kol_intersec_circle_line(circle c, line l);
pair<point, point> intersection_circle_line(circle c, line l);
line rad_os(circle c1, circle c2);
int kol_intersec_circle_circle(circle c1, circle c2);
pair<point, point> intersection_circle_circle(circle c1, circle c2);
int kol_tangent(circle c, point p);
pair<point, point> tangent(circle c, point p);
line tangent_point(circle c, point p);
long double square_treug(point a, point b, point c);
long double square_treug_stor(long double a, long double b, long double c);
polygon treug(point a, point b, point c);
bool in_polygon_easy(point p, polygon t);
long double deg_to_rad(long double a) { return (a / 180) * pi; }
long double rad_to_deg(long double a) { return (a / pi) * 180; }
point read_point_polar() {
  long double r, a;
  cin >> r >> a;
  a = deg_to_rad(a);
  return point(r * cos(a), r * sin(a));
}
long double angle_vect(vect a, vect b) {
  long double an = atan2(a ^ b, a * b);
  return fabs(an);
}
vect radius_v(point p) { return vect(point(0, 0), p); }
long double polar_angle(point p) {
  vect xn = radius_v(point(1, 0));
  vect yn = radius_v(point(0, 1));
  if (p.x >= 0 && p.y >= 0) return angle_vect(radius_v(p), xn);
  if (p.x >= 0 && p.y < 0)
    return (3 * pi) / 2 + angle_vect(yn * (-1), radius_v(p));
  if (p.x < 0 && p.y < 0) return pi + angle_vect(xn * (-1), radius_v(p));
  return pi / 2 + angle_vect(yn, radius_v(p));
}
long double length(point p1, point p2) { return vect(p1, p2).leng(); }
point point_napr(long double a) {
  point p = point(cos(a), sin(a));
  vect v = vect(point(0, 0), p);
  return go(point(0, 0), v);
}
line line_point(point p1, point p2) { return line(p1, vect(p1, p2)); }
point go(point p, vect v) { return point(p.x + v.x, p.y + v.y); }
line go_line(line l, vect v) {
  vect n = l.napr();
  point p = l.rand_point();
  point ne = go(p, v);
  return line(ne, n);
}
vect do_len(long double len, vect v) {
  long double r = v.leng();
  return vect(v.x * len / r, v.y * len / r);
}
bool is_in_luch(point p1, point vn, point vk) {
  long double r = vect(vn, p1).leng();
  vect v = vect(vn, vk);
  line l = line(vn, v);
  if (!l.is(p1)) return false;
  v = do_len(r, v);
  point p = go(vn, v);
  return (p == p1);
}
bool is_in_one_side(line l, point p1, point p2) {
  if (l.is(p1) || l.is(p2)) return true;
  return (!((l.f(p1) < 0) ^ (l.f(p2) < 0)));
}
bool is_in_otr(point p, point vn, point vk) {
  return is_in_luch(p, vn, vk) && is_in_luch(p, vk, vn);
}
long double dist_to_otr(point p, point vn, point vk) {
  line l = line_point(vn, vk);
  if (l.is(p)) {
    if (is_in_otr(p, vn, vk)) return 0;
    return min(length(p, vn), length(p, vk));
  }
  point osn = perp(p, l);
  if (is_in_otr(osn, vn, vk)) return length(p, osn);
  return min(length(p, vn), length(p, vk));
}
int kol_intersec_line_line(line l1, line l2) {
  long double d = l1.a * l2.b - l1.b * l2.a;
  long double dx = -l1.c * l2.b + l2.c * l1.b;
  long double dy = -l1.a * l2.c + l2.a * l1.c;
  if (fabs(d) < eps && fabs(dx) < eps && fabs(dy) < eps) return 2;
  if (fabs(d) < eps) return 0;
  return 1;
}
point intersection_line_line(line l1, line l2) {
  long double d = l1.a * l2.b - l1.b * l2.a;
  long double dx = -l1.c * l2.b + l2.c * l1.b;
  long double dy = -l1.a * l2.c + l2.a * l1.c;
  return point(dx / d, dy / d);
}
line centr_perp(point p1, point p2) {
  vect v = vect(p1, p2);
  v = vect(v.y, -v.x);
  point m = point((p1.x + p2.x) / 2, (p1.y + p2.y) / 2);
  return line(m, v);
}
point otnosh(point a, point b, long double m, long double n) {
  long double s = m + n;
  return point((m * a.x + n * b.x) / s, (m * a.y + n * b.y) / s);
}
line biss(point a, point b, point c) {
  vect v1 = vect(b, a);
  vect v2 = vect(b, c);
  v1 = do_len(1, v1);
  v2 = do_len(1, v2);
  vect v = v1 + v2;
  if (v.leng() < eps) return line(b, line_point(b, a).norm());
  return line(b, v);
}
line median(point a, point b, point c) {
  point s = otnosh(a, c, 1, 1);
  return line_point(b, s);
}
point perp(point p, line l) { return intersection_line_line(l, heig(p, l)); }
point simm(point p, line l) {
  point g = perp(p, l);
  vect v = vect(p, g);
  return go(g, v);
}
line heig(point p, line l) { return line(p, l.norm()); }
circle in_circle(point a, point b, point c) {
  circle ans;
  ans.p = intersection_line_line(biss(a, b, c), biss(b, a, c));
  ans.r = line_point(a, b).height(ans.p);
  return ans;
}
circle out_circle(point a, point b, point c) {
  line l1 = centr_perp(a, b);
  line l2 = centr_perp(a, c);
  circle ans;
  ans.p = intersection_line_line(l1, l2);
  ans.r = vect(ans.p, a).leng();
  return ans;
}
int kol_intersec_circle_line(circle c, line l) {
  long double h = l.height(c.p);
  if (fabs(h - c.r) < eps) return 1;
  return (c.r > h ? 2 : 0);
}
pair<point, point> intersection_circle_line(circle c, line l) {
  long double h = l.height(c.p);
  long double q = sqrt(c.r * c.r - h * h);
  point p = perp(c.p, l);
  vect go1 = do_len(q, l.napr());
  vect go2 = go1 * (-1);
  return make_pair(go(p, go1), go(p, go2));
}
line rad_os(circle c1, circle c2) {
  line l;
  l.a = 2 * (c2.p.x - c1.p.x);
  l.b = 2 * (c2.p.y - c1.p.y);
  l.c = c1.p.x * c1.p.x + c1.p.y * c1.p.y - c2.p.x * c2.p.x - c2.p.y * c2.p.y +
        c2.r * c2.r - c1.r * c1.r;
  return l;
}
int kol_intersec_circle_circle(circle c1, circle c2) {
  line l = rad_os(c1, c2);
  if (l.napr() == vect(0, 0) && fabs(c1.r - c2.r) < eps)
    return 3;
  else if (l.napr() == vect(0, 0))
    return 0;
  return kol_intersec_circle_line(c1, l);
}
pair<point, point> intersection_circle_circle(circle c1, circle c2) {
  return intersection_circle_line(c1, rad_os(c1, c2));
}
int kol_tangent(circle c, point p) {
  long double deg = c.degree(p);
  if (fabs(deg) < eps) return 1;
  if (deg < 0) return 0;
  return 2;
}
line tangent_point(circle c, point p) {
  long double a = p.x - c.p.x;
  long double b = p.y - c.p.y;
  return line(a, b, -c.r * c.r - a * c.p.x - b * c.p.y);
}
pair<point, point> tangent(circle c, point p) {
  long double deg = c.degree(p);
  circle n = circle(p, sqrt(deg));
  return intersection_circle_circle(n, c);
}
long double square_treug(point a, point b, point c) {
  return treug(a, b, c).square();
}
long double square_treug_stor(long double a, long double b, long double c) {
  long double p = (a + b + c) / 2;
  return sqrt(p * (p - a) * (p - b) * (p - c));
}
polygon treug(point a, point b, point c) {
  vector<point> y;
  y.push_back(a);
  y.push_back(b);
  y.push_back(c);
  return y;
}
bool in_polygon_easy(point p, polygon t) {
  vector<polygon> v;
  for (int i = 0; i < t.n - 1; i++) v.push_back(treug(t.p[i], t.p[i + 1], p));
  long double sq = t.square();
  long double now = 0;
  for (int i = 0; i < v.size(); i++) now += v[i].square();
  return fabs(sq - now) < eps;
}
istream &operator>>(istream &input_stream, point &a) {
  input_stream >> a.x >> a.y;
  return input_stream;
}
ostream &operator<<(ostream &output_stream, point &a) {
  output_stream << a.x << " " << a.y << "\n";
  return output_stream;
}
istream &operator>>(istream &input_stream, vect &a) {
  input_stream >> a.x >> a.y;
  return input_stream;
}
ostream &operator<<(ostream &output_stream, vect &a) {
  output_stream << a.x << " " << a.y << "\n";
  return output_stream;
}
istream &operator>>(istream &input_stream, line &a) {
  input_stream >> a.a >> a.b >> a.c;
  return input_stream;
}
ostream &operator<<(ostream &output_stream, line &a) {
  output_stream << a.a << " " << a.b << " " << a.c << "\n";
  return output_stream;
}
istream &operator>>(istream &input_stream, circle &a) {
  input_stream >> a.p.x >> a.p.y >> a.r;
  return input_stream;
}
ostream &operator<<(ostream &output_stream, circle &a) {
  output_stream << a.p.x << " " << a.p.y << " " << a.r << "\n";
  return output_stream;
}
istream &operator>>(istream &input_stream, polygon &p) {
  input_stream >> p.n;
  p.p.resize(p.n);
  for (int i = 0; i < p.n; i++) input_stream >> p.p[i];
  return input_stream;
}
ostream &operator<<(ostream &output_stream, polygon &p) {
  output_stream << p.n << "\n";
  for (int i = 0; i < p.n; i++) output_stream << p.p[i];
  return output_stream;
}
point seredka(point a, point b) {
  return point((a.x + b.x) / 2, (a.y + b.y) / 2);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  vector<point> a(4), b(4);
  for (int i = 0; i < 4; i++) {
    a[i].read();
  }
  for (int i = 0; i < 4; i++) {
    b[i].read();
  }
  point x = seredka(a[0], a[2]);
  point y = seredka(b[0], b[2]);
  bool kek = false;
  for (int i = -100; i <= 100; i++) {
    for (int j = -100; j <= 100; j++) {
      point cur = point(i, j);
      bool fst = true, sec = true;
      for (int k = 0; k < 4; k++) {
        if (!is_in_one_side(line(a[k], vect(a[k], a[(k + 1) % 4])), x, cur)) {
          fst = false;
        }
      }
      for (int k = 0; k < 4; k++) {
        if (!is_in_one_side(line(b[k], vect(b[k], b[(k + 1) % 4])), y, cur)) {
          sec = false;
        }
      }
      if (fst && sec) {
        kek = true;
      }
    }
  }
  if (kek) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
