Dr. Spaceman's height algorithm

Compute a child height range from both parents' heights and the child sex, then round both ends inward to whole inches.

Easy2ImplementationMathNo attempts yetTime limit5sMemory limit512 MB

Problem

Dr. Spaceman built an algorithm that takes the heights of both parents and reports the range a child's adult height falls into. The steps are:

  1. Convert the mother's height and the father's height to inches and add them.
  2. Add 5 inches for a boy, or subtract 5 inches for a girl.
  3. Divide the result by 2. This value is the middle of the predicted height.
  4. The middle minus 4 inches is the minimum, and the middle plus 4 inches is the maximum.

When parents ask about their child's height, Dr. Spaceman answers with that minimum and that maximum. One foot is 12 inches.

Input

The first line holds the number of test cases TT. Then TT lines follow.

Each line holds one letter, a space, the mother's height, a space, and the father's height, in that order. The letter B means a boy and G means a girl.

A height is written as feet, an apostrophe, inches, and a double quote. For example, 5'11" is 5 feet 11 inches. The feet value is a positive integer and the inch value is a non-negative integer.

Output

For each test case, print one line in the form Case #x: A to B. Here x is the case number starting at 1, and A and B are the minimum and the maximum height that Dr. Spaceman's algorithm produces. Write both in the same feet, apostrophe, inches, double quote format used by the input.

When the middle value is not a whole number of inches, shrink both ends of the range inward so that they become integers. The minimum rounds up and the maximum rounds down.

Unlike the input, the printed feet value is sometimes 0 or 10.

Constraints

  • 1T60001 \le T \le 6000
  • The feet value is an integer from 1 to 9.
  • The inch value is an integer from 0 to 11.