Hide

Problem C
Square Deal

Given the dimensions of three rectangles, determine if all three can be glued together, touching just on the edges, to form a square. You may rotate the rectangles. For example, Figure 1 shows successful constructions for the first two sample inputs.

\includegraphics[scale=0.6]{sample1.png}
(1.a)
  
\includegraphics[scale=0.6]{sample2.png}
(1.b)
Figure 1: Constructions for the first two examples

Input

The input consists of three lines, with line $j$ containing integers $H_ j$ and $W_ j$, designating the height and width of a rectangle, such that $100 \geq H_ j \geq W_ j \geq 1$, and such that $H_1 \geq H_2 \geq H_3$.

Output

Output a line saying YES if they can be glued together to form a square. Output NO otherwise.

Sample Input 1 Sample Output 1
7 3
7 1
7 3
YES
Sample Input 2 Sample Output 2
9 2
7 4
7 5
YES
Sample Input 3 Sample Output 3
3 1
3 2
3 3
NO

Please log in to submit a solution to this problem

Log in