favorite We need a little bit of your help to keep things running, click on this banner to learn more

Week 2: November 16 – 22. Conditional statement. Part 2


John is going to a tourist meeting of pupils in his school. In his class he was made responsible for the tents. At home he found 3 tents: the first one weighs a1 kilograms and accommodates b1 people, the second tent weighs a2 kilograms and accommodates b2 people, the third tent weighs a3 kilograms and accommodates b3 people.

There are k pupils in John's class. Find out if John can choose tents such that all people can fit in them. Take into account that the selected tents should weigh no more than w kilograms in total.


The first line contains two integers k and w (1k15, 1w30). The second line contains six integers: a1, b1, a2, b2, a3, b3 (1a1, a2, a310, 1b1, b2, b315).


Print YES if it is possible to choose tents as desired, and NO otherwise.

Time limit 1 second
Memory limit 128 MiB
Input example #1
10 10
5 5 6 6 4 5
Output example #1