D - Domino

Languages: C, C++, Java, Python, Kotlin, C#
Time & Memory limits: (details)

In a game of domino each piece has two numbers between 0 and 6. The pieces are placed face down and then shuffled. Before the game starts, each player draws seven pieces. The first player places any piece on its hand on the table face up. The next player must place a piece that matches one of the numbers on the piece that was just placed. Following up, a player must place a piece that matches one of the open heads on the board, i.e the two numbers that haven't been matched yet (they can be potentially the same number). If a player cannot place a piece, he pass his turn. The game ends when all the pieces have been played. The player that puts the last piece on the board wins the game.

Fito has been playing for some time until he has only one piece left. He is not sure if he can win the game or not. He asks you to help him. Given the piece that he has left and the board, determine if Fito can win the game or not.

Input

The first line contains four numbers. The first two numbers are the numbers on the piece that Fito has left (0 ≤ A, B ≤ 6). The next two numbers are the numbers on the open heads (0 ≤ C, D ≤ 6).

Output

Print YES if Fito can win the game, NO otherwise.

Sample test(s)

Input
1 2 3 4
Output
NO
Input
1 2 2 1
Output
YES