Yeongseon's Birthday

Given seven marked cells on an n by m grid (one candle, three cherries, three strawberries), decide whether the grid splits into four connected pieces so the candle piece holds no fruit and each other piece holds one cherry and one strawberry.

Medium7GeometryMathImplementationGreedyNo attempts yetTime limit2sMemory limit512 MB

Problem

Today is Yeongseon's birthday. Her friends prepared one rectangular birthday cake.

The top of the cake is divided into n×mn \times m cells. The top left cell is (1,1)(1, 1), the top right cell is (n,1)(n, 1), and the bottom right cell is (n,m)(n, m). In a coordinate (x,y)(x, y), xx is the column counted from the left and yy is the row counted from the top.

Seven cells carry one decoration each.

  • A candle sits on (x1,y1)(x_1, y_1).
  • Cherries sit on (x2,y2)(x_2, y_2), (x3,y3)(x_3, y_3), (x4,y4)(x_4, y_4).
  • Strawberries sit on (x5,y5)(x_5, y_5), (x6,y6)(x_6, y_6), (x7,y7)(x_7, y_7).

Yeongseon wants to cut the cake into four pieces. She eats one piece and her three friends eat the other three.

Every piece is made of cells, and every cell belongs to exactly one piece. Every piece must also be connected. Two cells that share a side are neighbours, and a piece is connected when you can travel between any two of its cells by stepping only on neighbouring cells of that same piece.

Yeongseon eats the piece that holds the candle, and each of the other three pieces must hold one strawberry and one cherry.

Given nn, mm, and the positions of the candle, the cherries and the strawberries, write a program that decides whether the cake can be cut this way.

Input

The first line contains nn and mm. (1n,m1091 \le n, m \le 10^9)

Each of the next seven lines contains one of (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2), ..., (x7,y7)(x_7, y_7). (1xin1 \le x_i \le n, 1yim1 \le y_i \le m)

Only cakes made of at least seven cells are given. The seven coordinates are distinct.

Output

Print "Yes" if the cake can be cut into four pieces that meet the conditions, and "No" otherwise.

Hint

The figure below shows one way to cut the cake of the third example. Cells of the same colour form one piece. The figure is drawn with the first coordinate running downwards and the second coordinate running to the right.

One valid cut of the cake in the third example