Bricky Jaiden
After his home-made time machine took him to ancient Egypt, Jaiden has been assigned a task by the locals - to cut huge limestone bricks for the currently-in-progress pyramid.
Each day, he is given a rectangular prism of limestone, and must carve it to a specified set of dimensions.
Luckily for him, if the hunk of limestone he is given cannot be carved to the specified dimensions, he does not have to do any work for the day. Can you help him determine if it is possible to carve the block into the specified dimensions?
Note that the blocks can be rotated in any way after carving them - the dimensions only need to match in some orientation.
Input
The first line consists of 3 integers
, the width, height, and length of the block that you may carve.
The next line also consists of 3 integers
, the width, height, and length of the block that is desired.
Output
Output Yes or No, depending on whether you can carve the first block into the dimensions of the second block.
Examples
Input 1
10 3 4
4 1 9
Output 1
Yes
It can be shown that some cuts can be made to the first block to achieve the exact dimensions of the second block. The original block (blue) is carved so that only the second block remains (red).

Input 2
10 3 4
4 3 10
Output 2
Yes
No cuts need to be made to achieve the exact dimensions of the second block.
Input 3
1 1 1
10 10 10
Output 3
No
It can be shown that it is impossible to achieve the exact dimensions of the second block. The starting block is smaller in all 3 dimensions.
Comments