Every person's blood has 2 markers called ABO alleles. Each
of the markers is represented by one of three letters: A, B, or
O. This gives six possible combinations of these alleles that a
person can have, each of them resulting in a particular ABO blood
type for that person.
Blood Type Genotype (six possible combinations)
A AA or AO
B BB or BO
Likewise, every person has two alleles for the blood Rh factor,
represented by the characters + and -. Someone who is "Rh positive"
or "Rh+" has at least one + allele, but could have two. Someone
who is "Rh negative" always has two - alleles.
The blood type of a person is a combination of ABO blood type
and Rh factor. The blood type is written by suffixing the ABO blood
type with the + or - representing the Rh factor. Examples include
A+, AB-, and O-.
Blood types are inherited: each biological parent donates one
ABO allele (randomly chosen from their two) and one Rh factor
allele to their child. Therefore 2 ABO alleles and 2 Rh factor
alleles of the parents determine the child's blood type. For
example, if both parents of a child have blood type A-, then the
child could have either type A- or type O- blood. A child of parents
with blood types A+ and B+ could have any blood type.
In this problem, you will be given the blood type of either
both parents or one parent and a child; you will then determine
the (possibly empty) set of blood types that might characterize
the child or the other parent.
Note: an uppercase letter "Oh" is used in this problem to denote
blood types, not a digit (zero).
The input consists of multiple test cases, it's indicated at the first part of the input - an integer N
Then follows N
lines, each test case is on a single line in the format: the blood type of the father, the blood type of the mother, and finally the blood type of the child, except that the blood type of one parent or the child will be replaced by a question mark.
For each test case in the input, print a line of the possible
blood type of the question marked person, started with the role
of this person and a colon.
Then print all the possible blood types separated by a space, and left a space before the first type. If there is no possible blood type, leave the left of the line blank.
The output should ordered by Rh type (positive first), then ABO type (A, B, AB then O).
A+ B+ ?
A- ? AB+
? O- AB-
Child: A+ B+ AB+ O+ A- B- AB- O-
Mother: B+ AB+