This page is still under construction.

Parts of this page are still being built. What you see may change.

Bricks

Time limit1sMemory limit128 MB

Summary
Given a rectangular brick and a rectangular hole, decide whether the brick can pass through the hole in any orientation.
Level

Medium6 of 10

Topics
Geometry, Math, Implementation
Solved
No attempts yet

Problem

A prisoner of the "IF" castle plans to escape by taking his cell's brick wall apart, one brick at a time. To keep the guards from noticing, he must secretly get rid of every brick he removes. Each brick is a rectangular box measuring A×B×CA \times B \times C inches and is far too strong to break. In the cell floor there is a small rectangular drain of size D×ED \times E inches that continues straight down as a well of the same cross-section; it is so deep that its depth can be ignored. The prisoner has measured AA, BB, CC, DD, EE exactly (to a tenth of an inch). Determine whether the bricks can be dropped through the hole.

Input

A single line with five numbers AA, BB, CC, DD, EE separated by spaces. AA, BB, CC are the lengths of the brick's sides and DD, EE are the lengths of the hole's sides. Every length is between 11 and 1010 inches inclusive and has at most one digit after the decimal point.

Output

Print YES on a single line if the bricks can be disposed of through the hole, and NO otherwise.

Examples2

  1. Example 1

    Input
    1.0 2.0 1.5 1.4 1.0
    
    Expected output
    NO
    
  2. Example 2

    Input
    1.0 2.0 1.5 1.5 1.0
    
    Expected output
    YES