#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int dy[] = {1, 0, -1, 0, 1, -1, 1, -1, 0};
long long fix_mod(long long x, long long y) { return (y + x % y) % y; }
void fast() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
struct point {
  long double x, y;
  point() { x = 0, y = 0; }
  point(long double a, long double b) { x = a, y = b; }
  bool operator<(point o) const { return x < o.x || x == o.x && y < o.y; }
};
point polygoncentriod(vector<point>& polygon) {
  point res = point((long double)0.0, (long double)0.0);
  long double a = 0;
  for (int i = 0; i < polygon.size(); i++) {
    int j = (i + 1) % polygon.size();
    res.x += (polygon[i].x + polygon[j].x) *
             (polygon[i].x * polygon[j].y - polygon[j].x * polygon[i].y);
    res.y += (polygon[i].y + polygon[j].y) *
             (polygon[i].x * polygon[j].y - polygon[j].x * polygon[i].y);
    a += polygon[i].x * polygon[j].y - polygon[i].y * polygon[j].x;
  }
  a *= 0.5;
  res.x /= 6 * a;
  res.y /= 6 * a;
  return res;
}
long double slope(point a, point b) {
  long double x = a.x - b.x;
  long double y = a.y - b.y;
  x *= -1;
  y *= -1;
  long double theta = atan2(y, x) * 180 / acos(-1);
  theta = fmod(fmod(theta, 360.0) + 360.0, 360.0);
  return theta;
}
struct line {
  long double a, b, c;
  line() { a = 0, b = 0, c = 0; }
  line(long double x, long double y, long double z) { a = x, b = y, c = z; }
  bool operator<(line o) const {
    return a < o.a || a == o.a && b < o.b || a == o.a && b == o.b && c < o.c;
  }
  bool operator==(line o) const { return a == o.a && b == o.b && c == o.c; }
};
line get_line(point x, point y) {
  line ret;
  ret.a = x.x - y.x;
  ret.b = x.y - y.y;
  ret.c = -ret.b * x.x + ret.a * x.y;
  ret.b *= -1;
  if (ret.a < 1E-9 || fabs(ret.a) < 1E-9 && ret.b < 1E-9) {
    ret.a *= -1;
    ret.b *= -1;
    ret.c *= -1;
  }
  if (ret.a) {
    ret.b /= ret.a, ret.c /= ret.a;
    ret.a /= ret.a;
  } else if (ret.b) {
    ret.a /= ret.b, ret.c /= ret.b, ret.b /= ret.b;
  } else if (ret.c) {
    ret.a /= ret.c, ret.b /= ret.c, ret.c /= ret.c;
  }
  return ret;
}
long double get_res_matrix(long double a[2][2]) {
  return a[0][0] * a[1][1] - a[0][1] * a[1][0];
}
point intersect_in_point(line a, line b) {
  point c;
  long double delta[2][2] = {{a.a, a.b}, {b.a, b.b}};
  long double delta_y[2][2] = {{a.c, a.b}, {b.c, b.b}};
  long double delta_x[2][2] = {{a.a, a.c}, {b.a, b.c}};
  long double del = get_res_matrix(delta);
  long double del_x = get_res_matrix(delta_x);
  long double del_y = get_res_matrix(delta_y);
  c = point(del_x / del, del_y / del);
  return c;
}
long double dis(point a, point b) {
  long double x = a.x - b.x;
  long double y = a.y - b.y;
  return (long double)sqrt(x * x + y * y);
}
int main() {
  fast();
  int n;
  cin >> n;
  vector<point> v(n);
  for (int i = 0; i < n; i++) cin >> v[i].x >> v[i].y;
  point center = polygoncentriod(v);
  vector<pair<long double, point>> vv;
  for (auto b : v) {
    vv.push_back({slope(center, b), b});
  }
  sort(vv.begin(), vv.end());
  int m;
  cin >> m;
  point p;
  while (m--) {
    cin >> p.x >> p.y;
    int idx1 =
        upper_bound(vv.begin(), vv.end(), make_pair(slope(center, p), p)) -
        vv.begin();
    idx1 %= n;
    int idx2 = idx1 - 1;
    idx2 += n;
    idx2 %= n;
    line a = get_line(vv[idx1].second, vv[idx2].second);
    line b = get_line(center, p);
    point c = intersect_in_point(a, b);
    if (fabs(dis(center, p) - dis(c, center) - dis(c, p)) < 1E-9)
      return cout << "NO"
                  << "\n",
             0;
    ;
  }
  return cout << "YES"
              << "\n",
         0;
  ;
}

### Prompt

Your task is to create a CPP solution to the following problem:

You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecutively following vertices are located on the same straight line.

Your task is to check whether polygon B is positioned strictly inside polygon A. It means that any point of polygon B should be strictly inside polygon A. "Strictly" means that the vertex of polygon B cannot lie on the side of the polygon A.

Input

The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order.

The next line contains a single integer m (3 ≤ m ≤ 2·104) — the number of vertices of polygon B. Then following m lines contain pairs of integers xj, yj (|xj|, |yj| ≤ 109) — the coordinates of the j-th vertex of polygon B. The vertices are given in the clockwise order.

The coordinates of the polygon's vertices are separated by a single space. It is guaranteed that polygons A and B are non-degenerate, that polygon A is strictly convex, that polygon B has no self-intersections and self-touches and also for each polygon no three consecutively following vertices are located on the same straight line.

Output

Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).

Examples

Input

6
-2 1
0 3
3 3
4 1
3 -2
2 -2
4
0 1
2 2
3 1
1 0


Output

YES


Input

5
1 2
4 2
3 -3
-2 -2
-2 1
4
0 1
1 2
4 1
2 -1


Output

NO


Input

5
-1 2
2 3
4 1
3 -2
0 -3
5
1 0
1 1
3 1
5 -1
2 -1


Output

NO

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int dy[] = {1, 0, -1, 0, 1, -1, 1, -1, 0};
long long fix_mod(long long x, long long y) { return (y + x % y) % y; }
void fast() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
struct point {
  long double x, y;
  point() { x = 0, y = 0; }
  point(long double a, long double b) { x = a, y = b; }
  bool operator<(point o) const { return x < o.x || x == o.x && y < o.y; }
};
point polygoncentriod(vector<point>& polygon) {
  point res = point((long double)0.0, (long double)0.0);
  long double a = 0;
  for (int i = 0; i < polygon.size(); i++) {
    int j = (i + 1) % polygon.size();
    res.x += (polygon[i].x + polygon[j].x) *
             (polygon[i].x * polygon[j].y - polygon[j].x * polygon[i].y);
    res.y += (polygon[i].y + polygon[j].y) *
             (polygon[i].x * polygon[j].y - polygon[j].x * polygon[i].y);
    a += polygon[i].x * polygon[j].y - polygon[i].y * polygon[j].x;
  }
  a *= 0.5;
  res.x /= 6 * a;
  res.y /= 6 * a;
  return res;
}
long double slope(point a, point b) {
  long double x = a.x - b.x;
  long double y = a.y - b.y;
  x *= -1;
  y *= -1;
  long double theta = atan2(y, x) * 180 / acos(-1);
  theta = fmod(fmod(theta, 360.0) + 360.0, 360.0);
  return theta;
}
struct line {
  long double a, b, c;
  line() { a = 0, b = 0, c = 0; }
  line(long double x, long double y, long double z) { a = x, b = y, c = z; }
  bool operator<(line o) const {
    return a < o.a || a == o.a && b < o.b || a == o.a && b == o.b && c < o.c;
  }
  bool operator==(line o) const { return a == o.a && b == o.b && c == o.c; }
};
line get_line(point x, point y) {
  line ret;
  ret.a = x.x - y.x;
  ret.b = x.y - y.y;
  ret.c = -ret.b * x.x + ret.a * x.y;
  ret.b *= -1;
  if (ret.a < 1E-9 || fabs(ret.a) < 1E-9 && ret.b < 1E-9) {
    ret.a *= -1;
    ret.b *= -1;
    ret.c *= -1;
  }
  if (ret.a) {
    ret.b /= ret.a, ret.c /= ret.a;
    ret.a /= ret.a;
  } else if (ret.b) {
    ret.a /= ret.b, ret.c /= ret.b, ret.b /= ret.b;
  } else if (ret.c) {
    ret.a /= ret.c, ret.b /= ret.c, ret.c /= ret.c;
  }
  return ret;
}
long double get_res_matrix(long double a[2][2]) {
  return a[0][0] * a[1][1] - a[0][1] * a[1][0];
}
point intersect_in_point(line a, line b) {
  point c;
  long double delta[2][2] = {{a.a, a.b}, {b.a, b.b}};
  long double delta_y[2][2] = {{a.c, a.b}, {b.c, b.b}};
  long double delta_x[2][2] = {{a.a, a.c}, {b.a, b.c}};
  long double del = get_res_matrix(delta);
  long double del_x = get_res_matrix(delta_x);
  long double del_y = get_res_matrix(delta_y);
  c = point(del_x / del, del_y / del);
  return c;
}
long double dis(point a, point b) {
  long double x = a.x - b.x;
  long double y = a.y - b.y;
  return (long double)sqrt(x * x + y * y);
}
int main() {
  fast();
  int n;
  cin >> n;
  vector<point> v(n);
  for (int i = 0; i < n; i++) cin >> v[i].x >> v[i].y;
  point center = polygoncentriod(v);
  vector<pair<long double, point>> vv;
  for (auto b : v) {
    vv.push_back({slope(center, b), b});
  }
  sort(vv.begin(), vv.end());
  int m;
  cin >> m;
  point p;
  while (m--) {
    cin >> p.x >> p.y;
    int idx1 =
        upper_bound(vv.begin(), vv.end(), make_pair(slope(center, p), p)) -
        vv.begin();
    idx1 %= n;
    int idx2 = idx1 - 1;
    idx2 += n;
    idx2 %= n;
    line a = get_line(vv[idx1].second, vv[idx2].second);
    line b = get_line(center, p);
    point c = intersect_in_point(a, b);
    if (fabs(dis(center, p) - dis(c, center) - dis(c, p)) < 1E-9)
      return cout << "NO"
                  << "\n",
             0;
    ;
  }
  return cout << "YES"
              << "\n",
         0;
  ;
}

```