Submit | All submissions | Best solutions | Back to list |
RECFRAME - Photos in a Frame |
After his sister’s marriage Ashvant was given the job of preparing the marriage photo album. There were many photos (rectangular in shape), so he planned to put two photos in a single frame (also rectangular in shape). Since there were many photos and many frames each of varying sizes, he randomly chose two photos and a frame and asked his friend Senthil whether he could put these two photos in that frame.
There were some conditions:
- The two photos should be placed completely inside the frame.
- The two photos can touch each other and the edges of the frame but cannot overlap or go beyond the edge of the frame.
- we can rotate the two photos but at least one edge of each of the photos must be parallel to an edge of the frame.
Given the dimensions of the two photos and frame, Senthil has to tell whether it is possible to place the two photos inside the frame. Help Senthil!
Input
The first line of the input has t — the number of test cases.
Each test case contains a single line n, m, a, b, c, d.
- n and m: the dimensions of the frame.
- a and b: the dimensions of the first photo.
- c and d: the dimensions of the second photo.
1 <= t <= 10000, 1 <= n, m, a, b, c, d <= 1000000
Output
For each test case, if the photos can be placed inside the frame, print "Yes" else print "No".
Example
Input: 1 3 2 1 3 2 1 Output: Yes
Added by: | Sundar |
Date: | 2015-10-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |
Resource: | own |