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.

Figure 1: Constructions for the first two examples


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 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
Sample Input 2 Sample Output 2
9 2
7 4
7 5
Sample Input 3 Sample Output 3
3 1
3 2
3 3

Please log in to submit a solution to this problem

Log in