Background
A thick bundle of bank notes crunched nicely in the purse of hereditary abstract painter Aristarh M. Petroff. Heaps of coins weighed his pocket down, and their ring charmed ear of the devoted admirer and true connoisseur of money.
Aristarh had just made the greatest bargain in the history of modern fine arts — he sold a series of pictures under the general name
"Rectangles" to some eccentric millionaire. Neither warm rays of autumn sun nor a soft breeze, nor even a bird chirping — nothing could stop that feeling of unlimited happiness.
But there was something, that darkened the life of Mr. Petroff greatly. Not all of the pictures were bought by the greedy millionaire. Rectangles painted on five of them appeared to be too small for him. The millionaire asked indignantly: "Should I look at them via a magnifying glass?" Aristarh is a creative personality, so any criticism causes no damage to him. But the holy principle "money is above all" gave him no rest, and Mr. Petroff intended to sell those five pictures. But the trick was how to do it.
Problem
At that moment another brilliant idea came to Mr. Petroff's mind. By means of his favourite knife (an extremely forcible argument for negotiations with customers) he cut five rectangles out of all the pictures. Aristarh calculated the lengths of the sides W[i] and H[i] of each rectangle and started to fulfil his splendid intention.
According to proposed conception, one large rectangle should be formed out of five small ones. The rectangles must not overlap. Mr. Petroff decided to decline further usage of the knife, because a true master is just not able to cut his achieved through suffering (and very expensive) masterpieces. It should be remembered, that all the rectangles must be used, otherwise the painter's heart will not endure it — and will break into thousands of tiny rectangles…
Input
Each of the five lines contains the integer numbers W[i] and H[i] (1 ≤ W[i], H[i] ≤ 1000) for the corresponding rectangle.
Output
If the desired rectangle exists, you should output "YES". Otherwise you should output "NO".
Sample
input | output |
---|
2 4
3 2
5 3
2 5
2 5
| YES
|
Problem Author: Nikita Rybak, Ilya Grebnov, Dmitry Kovalioff
Problem Source: Timus Top Coders: Second Challenge