Pop-Up Orientation
Practice
3.4 (16 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
91% Success 3552 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

In web application development, it is often required to draw a pop-up window on top of a web page when the user clicks on an icon on the page that brings up the pop-up.
You are given a web page with width x and height y, a pop-up window with width l and height m, and an icon at distance a from the left of the page and distance b from the bottom of the page.
Your program should output the orientation in which the pop-up can be rendered fully, relative to the icon, within the page dimensions. The orientation of pop up should be such that it lies completely within the page.
There are 4 possible orientations: bottom-right, bottom-left, top-right and top-left, in the same order of preference. In other words, you should first attempt to render the pop-up bottom-right, and if that is not possible, try bottom-left, and so on.

Note: Icon location and pop-up size are such that the pop-up can always be fully rendered within the page.

Input:
First line contains an integer, T, denoting the number of test cases.
Next T lines contain six space separated integers each, x, y, l, m, a and b.

Output:
For each test case, print the orientation in which the pop-up can be rendered fully, relative to the icon, within the page dimensions.

Constraints:
\(1 \le T \le 10^5\)
\(1 \le x \le 3000\)
\(1 \le y \le 3000\)
\(1 \le l \le x\)
\(1 \le m \le y\)
\(0 \le a \le x\)
\(0 \le b \le y\)
There is always an orientation possible such that the pop-up will lie within the page.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
836 votes
Tags:
Ad-HocSimulationEasyMathematicsOpenApprovedMathamatics
Points:20
38 votes
Tags:
ApprovedEasyGeometryMathOpen
Points:20
24 votes
Tags:
Basic ProgrammingEasyMath