Under construction

Still being built. Things may change

Escaping

Time limit1sMemory limit512 MB

Summary
Given officer and thief positions on an infinite grid, decide whether the thief can evade capture forever when all pieces move one step per turn.
Level

Medium7 of 10

Topics
Geometry, Sorting
Solved
No attempts yet

Problem

Consider a game of catching a thief on an infinite integer grid. The thief starts at one lattice point, and NN police officers are placed on NN different lattice points that do not contain the thief. The thief and the NN officers take turns moving, and the thief moves first. On the police turn, all NN officers move at the same time. Each officer and the thief can move to one of the four adjacent lattice points (up, down, left, or right). An officer may stay in place, but the thief must move to a neighboring lattice point on every turn. If an officer and the thief land on the same lattice point, the thief is caught and the game ends. Both sides play optimally. The thief tries to avoid capture, and the police try to catch the thief as quickly as possible.

For a given starting configuration, call it "escapable" if the thief can keep running forever no matter how the police play. For example, in the left figure below, the thief can only move north or south, so the police can never catch the thief. In the right figure, the thief is caught by the police no matter how it runs.

Given the initial positions of the thief and the NN officers, determine whether the configuration is escapable.

Input

The first line contains the number of police officers NN, where 1≤N≤500,0001 \le N \le 500{,}000. The next NN lines each contain the starting coordinates (xi,yi)(x_i, y_i) of one officer, separated by a space. The next line contains the starting coordinates (sx,sy)(s_x, s_y) of the thief, separated by a space. All coordinates are distinct lattice points, and the integers satisfy −109≤xi,yi,sx,sy≤109-10^9 \le x_i, y_i, s_x, s_y \le 10^9.

Output

If the thief can run forever from the given initial configuration, that is, the configuration is escapable, print YES. Otherwise, print NO.

Examples2

  1. Example 1

    Input
    2
    1 3
    5 3
    3 3
    
    Expected output
    YES
    
  2. Example 2

    Input
    2
    1 5
    5 1
    3 3
    
    Expected output
    NO