14989 - RedCapeFlyingCat's Nested Rectangles   

Description

RedCapeFlyingCat found two rectangles, one of which completely contains the other, and wants to know which one contains which.

Two axis-aligned rectangles and are given. It is guaranteed that one of them contains the other (a rectangle's own boundary counts as part of it). Determine whether contains , or contains .

Note

The image below is the sample test case.

Subtasks

Testcase Constraints
1-5 and do not share any boundary.
6-10 No additional constraint.

Input

Eight lines, each with one integer. For a rectangle , its bottom-left corner is and its top-right corner is ( increases rightward, increases upward).

  • Line 1:
  • Line 2:
  • Line 3:
  • Line 4:
  • Line 5:
  • Line 6:
  • Line 7:
  • Line 8:

Constraint:

  • and (likewise for ): rectangles are never degenerate
  • Either contains , or contains

Output

One line containing A or B: the rectangle that contains the other.

If and are identical, output A.

Sample Input  Download

Sample Output  Download

Tags




Discuss