2002 LSU Computer Science High School Programming Contest

Sponsored by Microsoft

Novice - Problem 3

Family Ties

Unfortunately, Sam's bandwidth woes have turned out to be greater than he anticipated. An unabashed (if lazy) opportunist, Sam has decided to make some money the easy way--tricking people out of it.

In his latest job at a hospital, Sam has access to the birth records. By switching newborns' parents around, he can 'conveniently' fix the families up properly after a few days, and hopefully get cash awards from both sides. However, he needs to make sure that when he switches the kids around, there's no way that the blood types match up with the new parents--they might not believe him otherwise.

Description:

Your task is to write a program that determines if two parents could have had a particular child, based on their blood types and the child's blood type. Every person has two parts to their blood type; each part can be one of A, B, or O. A child gets one part at random from their mother and one at random from their father, so there are four possible combinations (ignoring order) from any two parents. Of course, some of these may be duplicates. For example, a mother whose blood type is AB and a father whose blood type is AO can produce children of types AA, AB, AO, and BO, but not BB or OO.

Remember that the order of the parts in any person's blood type is irrelevant.

Input:

The first piece of data in the file is the number of mother-father-child sets to process, represented by a non-negative integer. For each set, there are three lines of data. Each line consists of two capital letters with no spaces in-between; the letters are from the set {A, B, O}. The first line of a set is the mother's blood type; the second line of a set is the father's blood type; the third line of a set is the prospective child's blood type.

Output:

For each set, print

	Set n: This could be their child.
if it is possible that the child is for those parents, or
	Set n: This cannot be their child.
if it is not possible. n is the set number, starting from 1.

Sample Input:

3		Number of sets
AA		Set 1 - Mother's blood type 
AB		Set 1 - Father's blood type
BO		Set 1 - Child's blood type
AO		Set 2 - Mother's blood type
BO		Set 2 - Father's blood type
OO		Set 2 - Child's blood type
AA		Set 3 - Mother's blood type
AA		Set 3 - Father's blood type
AA		Set 3 - Child's blood type

Sample Output:

Set 1: This cannot be their child.
Set 2: This could be their child.
Set 3: This could be their child.