#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ll long long
#define int long long
#define pii pair<int, int>
double eps = 1e-9;
int sign(double x){return (x>eps)-(x<eps);}
struct P{
ll x , y;
P(){x = 0, y = 0;}
P(ll x, ll y) : x(x),y(y){}
P operator - (const P& a)const{
return P(x-a.x, y-a.y);
}
ll operator * (const P& b){
return x*b.y - y*b.x;
}
int orientation(const P& a, const P& b)const{
return sign((a - *this)*(b - *this));
}
};
istream &operator>>(istream &in, P& p){return in>>p.x>>p.y;}
ostream &operator<<(ostream &out, P& p){return out<<p.x<<p.y;}
inline double cross(P a, P b){return a.x*b.y - a.y*b.x;}
bool is_seg(P a, P b,P p){
if(fabs(cross(p-b, a-b))<eps){
if(p.x<min(a.x, b.x) - eps || p.x>max(a.x,b.x)+eps)
return false;
if(p.y<min(a.y, b.y) - eps || p.y>max(a.y,b.y)+eps)
return false;
return true;
}
return false;
}
bool is_on(vector<P>& p, const P& z){
int n = p.size();
for(int i = 0; i < n ; i++){
if(is_seg(p[i],p[i+1%n],z)) return 1;
}
return 0;
}
int winding_number(vector<P>& p, const P& z){
if(is_on(p,z))return 1e9;
int n = p.size(),ans = 0;
for(int i = 0; i < n; i++){
int j = (i+1)%n;
bool below = p[i].y<z.y;
if(below !=(p[j].y < z.y)){
auto ori = z.orientation(p[j],p[i]);
if(ori == 0)return 0;
if(below == (ori > 0))ans+= below ? 1: -1;
}
}
return ans;
}
int in_poly(vector<P>& p, const P& z){
int k = winding_number(p, z);
return k == 1e9 ? 0 : k == 0 ? 1: -1;
}
void solve(){
int n; cin >> n;
vector<P> points(n);
for(int i = 0; i < n; i++) cin>>points[i];
P z;
cin>>z;
int ans = in_poly(points, z);
if(ans == 1) cout<<"NO\n";
else cout<<"YES\n";
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1, tc = 0;
// cin >> t ;
while(t--){
// cout << "Case " << ++tc << ": ";
solve();
}
return 0;
}