DMPG '15 B2 - Trunk in Trunk

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 32M

Problem type

Bob has finally managed to get a few friends to tag along with him on his camping trip. He has packed all of his stuff neatly into a trunk, but he has trouble fitting the trunk into the trunk of his car. Can he fit the trunk into his car, or is his trunk too large for his trunk?

Bob's trunk is a rectangular prism, with dimensions of A \times B \times C. Similarly, his car trunk is also a rectangular prism, with dimensions of D \times E \times F. Bob's trunk can rotate his trunk, but it must lie flat on a side (i.e. he can only rotate his trunk in multiples of 90^{\circ}).

Input Specification

The first line of input will contain three integers A, B, C (1 \le A, B, C \le 10^3).
The second and last line of input will contain the integers D, E, and F (1 \le D, E, F \le 10^3), respectively.

Output Specification

A single character, either Y if the trunk will fit, or N if the trunk does not.

Sample Input 1

2 3 3
3 3 3

Sample Output 1


Sample Input 2

2 3 4
4 2 2

Sample Output 2