Heating Up


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 640M

Authors:
Problem type
Allowed languages
Assembly, C, C++, Java, Kotlin, Pascal, Perl, Python, Scratch, Text

The suspence at the ICPC South Pacific Preliminary Contest is really heating up. In fact, this metaphorical fire has gotten so strong that it has become literal!

Div just wanted to participate for fun. Now, she has to work out whether she can escape the growing fire based on the position of herself and the fire relative to the exit door.

Will she escape, or will the unthinkable happen? Will she...

... have to use the convenient handheld teleportation device that can immediately teleport her to safety? Because man, it takes fooorreeeever to recharge. And the jingle it plays once it's fully charged again is really annoying and whiny.

This room is a rectangular grid, and is of size \(m \times n, 2 \leq m, n \leq 1000\). Both the fire and Div start somewhere in this room. If Div can move to position \((0, 0)\) (the exit) without ever standing on a cell that is on fire, then Div can escape without teleporting.

However, every time Div moves to another cell, all cells adjacent to a cell on fire also catch on fire.

Input

The input consists of three lines:

  • The first line contains an integer \(2 \lt m \lt 1000\) and an integer \(2 \lt n \lt 1000\), denoting the dimensions of the room
  • The second line contains an integer \(0 \leq i \lt m\) and an integer \(0 \leq j \lt n\), representing Div's initial position
  • The third line contains an integer \(0 \leq x \lt m\) and an integer \(0 \leq y \lt n\), representing the fire's initial position

Both Div and the fire cannot start at the same location (\((i, j) \neq (x, y)\)).

Output

The program must output Yes if Div can reach \((0, 0)\) without ever being in a cell containing fire, or No if she cannot.

Examples

Example 1

Input:

6 5
5 0
2 4

Output:

Yes

Here is a diagram illustrating this example:

Example 2

Input:

4 4
0 1
1 0

Output:

No

Here is a diagram illustrating this example:


Comments

There are no comments at the moment.