#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;
while (n--)
{
int x, y; cin >> 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;
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;
}
}