#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
struct Point {
  double x, y;
  bool operator<(const Point &rhs) const {
    return (x == rhs.x && y < rhs.y) || (x < rhs.x);
  }
  bool operator>(const Point &rhs) const {
    return (x == rhs.x && y > rhs.y) || (x > rhs.x);
  }
  bool operator==(const Point &rhs) const { return x == rhs.x && y == rhs.y; }
  bool operator!=(const Point &rhs) const { return x != rhs.x || y != rhs.y; }
  bool operator<=(const Point &rhs) const {
    return *this < rhs || *this == rhs;
  }
  bool operator>=(const Point &rhs) const {
    return *this > rhs || *this == rhs;
  }
  Point operator+(const Point &rhs) const { return {x + rhs.x, y + rhs.y}; }
  Point operator-(const Point &rhs) const { return {x - rhs.x, y - rhs.y}; }
  Point operator*(const Point &rhs) const { return {x * rhs.x, y * rhs.y}; }
  Point operator/(const Point &rhs) const { return {x / rhs.x, y / rhs.y}; }
  Point operator+(const double &rhs) const { return {x + rhs, y + rhs}; }
  Point operator-(const double &rhs) const { return {x - rhs, y - rhs}; }
  Point operator*(const double &rhs) const { return {x * rhs, y * rhs}; }
  Point operator/(const double &rhs) const { return {x / rhs, y / rhs}; }
};
struct Line {
  double a, b, c;
  Line() {}
  Line(const double &_a, const double &_b, const double &_c)
      : a{_a}, b{_b}, c{_c} {}
  Line(const Point &p1, const Point &p2) {
    a = p1.y - p2.y;
    b = -(p1.x - p2.x);
    c = -(a * p1.x + b * p1.y);
  }
};
template <class T>
inline bool inRange(T a, T b, T c) {
  return min(b, c) <= a && a <= max(b, c);
}
inline double distance(Point a, Point b) {
  a = (a - b) * (a - b);
  return sqrt(a.x + a.y);
}
inline bool onLine(Point p, Point b, Point c) {
  return (p.y - c.y) * (c.x - b.x) == (c.y - b.y) * (p.x - c.x);
}
inline bool onSegment(Point p, Point b, Point c) {
  return inRange(p.x, b.x, c.x) && inRange(p.y, b.y, c.y);
}
inline double crossProduct(Point a, Point b, Point c) {
  return (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y);
}
inline double orientation(Point a, Point b, Point c) {
  double cr = crossProduct(a, b, c);
  return (cr != 0) * (cr / abs(cr));
}
inline double distanceToLine(const Point &p, const Line &l) {
  return (-(l.a * p.x + l.b * p.y + l.c)) / (l.a * l.a + l.b * l.b);
}
inline Point projectToLine(const Point &p, const Line &l) {
  double d = distanceToLine(p, l);
  return {p.x + d * l.a, p.y + d * l.b};
}
inline double polygonArea(const vector<Point> &v) {
  double a = 0;
  int n = v.size();
  for (int i = 0; i < n; i++)
    a += v[i].x * v[(i + 1) % n].y - v[i].y * v[(i + 1) % n].x;
  return abs(a) / 2;
}
inline bool isSegmentIntersect(const Point &a, const Point &b, const Point &c,
                               const Point &d) {
  double o1 = orientation(a, b, c);
  double o2 = orientation(a, b, d);
  double o3 = orientation(c, d, a);
  double o4 = orientation(c, d, b);
  return (o1 != o2 && o3 != o4) || (!o1 && onSegment(a, c, b)) ||
         (!o2 && onSegment(a, d, b)) || (!o3 && onSegment(c, a, d)) ||
         (!o4 && onSegment(c, b, d));
}
inline double pointToSegment(const Point &p, const Point &p1, const Point &p2) {
  Line L(p1, p2);
  Point pr = projectToLine(p, L);
  return (inRange(pr.x, p1.x, p2.x) && (inRange(pr.y, p1.y, p2.y))
              ? abs(L.a * p.x + L.b * p.y + L.c) / sqrt(L.a * L.a + L.b * L.b)
              : min(distance(p, p1), distance(p, p2)));
}
inline double segmentToSegment(const Point &p1, const Point &q1,
                               const Point &p2, const Point &q2) {
  if (isSegmentIntersect(p1, q1, p2, q2)) return 0;
  double a, b, c, d;
  a = pointToSegment(p1, p2, q2);
  b = pointToSegment(q1, p2, q2);
  c = pointToSegment(p2, p1, q1);
  d = pointToSegment(q2, p1, q1);
  return min(min(a, b), min(c, d));
}
inline vector<Point> monotoneChain(vector<Point> v) {
  sort(v.begin(), v.end());
  int n = v.size(), k = 0;
  vector<Point> CH(2 * n);
  for (int i = 0; i < n; i++) {
    while (k >= 2 && crossProduct(CH[k - 2], CH[k - 1], v[i]) < 0) k--;
    CH[k++] = v[i];
  }
  for (int i = n - 1, t = k + 1; i > 0; i--) {
    while (k >= t && crossProduct(CH[k - 2], CH[k - 1], v[i - 1]) < 0) k--;
    CH[k++] = v[i - 1];
  }
  CH.resize(k - 1);
  return CH;
}
inline Point lineIntersection(Line a, Line b) {
  double x, y, det;
  det = a.a * b.b - b.a * a.b;
  if (det == 0) return {FLT_MAX, FLT_MAX};
  x = (b.b * a.c - a.b * b.c) / det;
  y = (a.a * b.c - b.a * a.c) / det;
  return {x, y};
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n;
  vector<Point> a(n), ab(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
    ab[i] = a[i];
  }
  cin >> m;
  vector<Point> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i].x >> b[i].y;
    ab.push_back(b[i]);
  }
  vector<Point> res = monotoneChain(ab);
  sort(a.begin(), a.end());
  sort(res.begin(), res.end());
  puts(res == a ? "YES" : "NO");
  return 0;
}

### Prompt

Generate 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;
const double PI = acos(-1);
struct Point {
  double x, y;
  bool operator<(const Point &rhs) const {
    return (x == rhs.x && y < rhs.y) || (x < rhs.x);
  }
  bool operator>(const Point &rhs) const {
    return (x == rhs.x && y > rhs.y) || (x > rhs.x);
  }
  bool operator==(const Point &rhs) const { return x == rhs.x && y == rhs.y; }
  bool operator!=(const Point &rhs) const { return x != rhs.x || y != rhs.y; }
  bool operator<=(const Point &rhs) const {
    return *this < rhs || *this == rhs;
  }
  bool operator>=(const Point &rhs) const {
    return *this > rhs || *this == rhs;
  }
  Point operator+(const Point &rhs) const { return {x + rhs.x, y + rhs.y}; }
  Point operator-(const Point &rhs) const { return {x - rhs.x, y - rhs.y}; }
  Point operator*(const Point &rhs) const { return {x * rhs.x, y * rhs.y}; }
  Point operator/(const Point &rhs) const { return {x / rhs.x, y / rhs.y}; }
  Point operator+(const double &rhs) const { return {x + rhs, y + rhs}; }
  Point operator-(const double &rhs) const { return {x - rhs, y - rhs}; }
  Point operator*(const double &rhs) const { return {x * rhs, y * rhs}; }
  Point operator/(const double &rhs) const { return {x / rhs, y / rhs}; }
};
struct Line {
  double a, b, c;
  Line() {}
  Line(const double &_a, const double &_b, const double &_c)
      : a{_a}, b{_b}, c{_c} {}
  Line(const Point &p1, const Point &p2) {
    a = p1.y - p2.y;
    b = -(p1.x - p2.x);
    c = -(a * p1.x + b * p1.y);
  }
};
template <class T>
inline bool inRange(T a, T b, T c) {
  return min(b, c) <= a && a <= max(b, c);
}
inline double distance(Point a, Point b) {
  a = (a - b) * (a - b);
  return sqrt(a.x + a.y);
}
inline bool onLine(Point p, Point b, Point c) {
  return (p.y - c.y) * (c.x - b.x) == (c.y - b.y) * (p.x - c.x);
}
inline bool onSegment(Point p, Point b, Point c) {
  return inRange(p.x, b.x, c.x) && inRange(p.y, b.y, c.y);
}
inline double crossProduct(Point a, Point b, Point c) {
  return (b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y);
}
inline double orientation(Point a, Point b, Point c) {
  double cr = crossProduct(a, b, c);
  return (cr != 0) * (cr / abs(cr));
}
inline double distanceToLine(const Point &p, const Line &l) {
  return (-(l.a * p.x + l.b * p.y + l.c)) / (l.a * l.a + l.b * l.b);
}
inline Point projectToLine(const Point &p, const Line &l) {
  double d = distanceToLine(p, l);
  return {p.x + d * l.a, p.y + d * l.b};
}
inline double polygonArea(const vector<Point> &v) {
  double a = 0;
  int n = v.size();
  for (int i = 0; i < n; i++)
    a += v[i].x * v[(i + 1) % n].y - v[i].y * v[(i + 1) % n].x;
  return abs(a) / 2;
}
inline bool isSegmentIntersect(const Point &a, const Point &b, const Point &c,
                               const Point &d) {
  double o1 = orientation(a, b, c);
  double o2 = orientation(a, b, d);
  double o3 = orientation(c, d, a);
  double o4 = orientation(c, d, b);
  return (o1 != o2 && o3 != o4) || (!o1 && onSegment(a, c, b)) ||
         (!o2 && onSegment(a, d, b)) || (!o3 && onSegment(c, a, d)) ||
         (!o4 && onSegment(c, b, d));
}
inline double pointToSegment(const Point &p, const Point &p1, const Point &p2) {
  Line L(p1, p2);
  Point pr = projectToLine(p, L);
  return (inRange(pr.x, p1.x, p2.x) && (inRange(pr.y, p1.y, p2.y))
              ? abs(L.a * p.x + L.b * p.y + L.c) / sqrt(L.a * L.a + L.b * L.b)
              : min(distance(p, p1), distance(p, p2)));
}
inline double segmentToSegment(const Point &p1, const Point &q1,
                               const Point &p2, const Point &q2) {
  if (isSegmentIntersect(p1, q1, p2, q2)) return 0;
  double a, b, c, d;
  a = pointToSegment(p1, p2, q2);
  b = pointToSegment(q1, p2, q2);
  c = pointToSegment(p2, p1, q1);
  d = pointToSegment(q2, p1, q1);
  return min(min(a, b), min(c, d));
}
inline vector<Point> monotoneChain(vector<Point> v) {
  sort(v.begin(), v.end());
  int n = v.size(), k = 0;
  vector<Point> CH(2 * n);
  for (int i = 0; i < n; i++) {
    while (k >= 2 && crossProduct(CH[k - 2], CH[k - 1], v[i]) < 0) k--;
    CH[k++] = v[i];
  }
  for (int i = n - 1, t = k + 1; i > 0; i--) {
    while (k >= t && crossProduct(CH[k - 2], CH[k - 1], v[i - 1]) < 0) k--;
    CH[k++] = v[i - 1];
  }
  CH.resize(k - 1);
  return CH;
}
inline Point lineIntersection(Line a, Line b) {
  double x, y, det;
  det = a.a * b.b - b.a * a.b;
  if (det == 0) return {FLT_MAX, FLT_MAX};
  x = (b.b * a.c - a.b * b.c) / det;
  y = (a.a * b.c - b.a * a.c) / det;
  return {x, y};
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n;
  vector<Point> a(n), ab(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
    ab[i] = a[i];
  }
  cin >> m;
  vector<Point> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i].x >> b[i].y;
    ab.push_back(b[i]);
  }
  vector<Point> res = monotoneChain(ab);
  sort(a.begin(), a.end());
  sort(res.begin(), res.end());
  puts(res == a ? "YES" : "NO");
  return 0;
}

```