//SUST_ZadeedBoss_Fanclub
//code_korlei_life_ase
//na_korle_lifeNai
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using o_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define double long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
void solve ()
{
int n; cin >>n;
vector <pair <int, int>> inp(n);
for (auto &it : inp)
{
cin >>it.first >>it.second;
}
int x, y; cin >>x >>y;
int cnt = 0;
bool hobe = 1;
for (auto &it : inp)
{
if (it.first == x && it.second == y) hobe = 0;
}
for (int i=0; i<n; i++)
{
int a1 = inp[i].first, b1 = inp[i].second;
int a2 = inp[(i+1)%n].first, b2 = inp[(i+1)%n].second;
if (b1 == y ^ b2 == y) {cnt++; continue;}
if (min(b1, b2) < y && max(b1, b2) > y)
{
int db = b2 - b1;
if (db == 0)
{
if (b1 == y)
{
if (min(a1, a2) < x && max(a1, a2) > x) {hobe = 0; break;}
}
continue;
}
int da = a2 - a1;
int ndb = y - b1;
if ((da * ndb) % db == 0 && a1 + (da * ndb) / db == x) {hobe = 0; break; }
int nda = da * ndb / db;
if (db * nda < da * ndb) nda++;
if (a1 + nda > x) cnt++;
}
}
if (!hobe) cnt = 0;
if (cnt &1) cout <<"YES\n";
else cout <<"NO\n";
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int TCASE = 1;
// cin >> TCASE;
for (int tcase = 1; tcase <= TCASE; tcase++)
{
solve();
}
}