#include <iostream>
#include <vector>
using namespace std;
struct Point {
int x, y;
};
// Function to check if a point is strictly inside a polygon
bool isPointInsidePolygon(const vector<Point>& polygon, Point p) {
int n = polygon.size();
bool inside = false;
for (int i = 0, j = n - 1; i < n; j = i++) {
// Check if the point lies within the y-bounds of the edge
if ((polygon[i].y > p.y) != (polygon[j].y > p.y)) {
// Check if the ray crosses the edge
double intersectionX = polygon[j].x + (p.y - polygon[j].y) * 1.0 * (polygon[i].x - polygon[j].x) / (polygon[i].y - polygon[j].y);
if (p.x < intersectionX) {
inside = !inside;
}
}
}
return inside;
}
int main() {
int n;
cin >> n;
vector<Point> polygon(n);
for (int i = 0; i < n; i++) {
cin >> polygon[i].x >> polygon[i].y;
}
Point p;
cin >> p.x >> p.y;
if (isPointInsidePolygon(polygon, p)) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}