#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int x_min = INT_MAX, x_max = INT_MIN;
int y_min = INT_MAX, y_max = INT_MIN;
vector<pair<int, int>> v;
while (n--)
{
int x, y;
cin >> x >> y;
v.push_back({x, y});
x_min = min(x, x_min);
x_max = max(x, x_max);
y_min = min(y, y_min);
y_max = max(y, y_max);
}
int x, y;
cin >> x >> y;
int flag = 0;
for (auto &i : v)
{
if (i.first == x && i.second == y)
{
cout << "YES" << endl;
return 0;
}
}
if ((x > x_min && x < x_max) && (y > y_min && y < y_max))
{
cout << "YES" << endl;
}
else if ((x_max == x_min && x == x_min) || (y_max == y_min && y == y_min))
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}