The GTUG Team was once invited to attend a marriage Party by two families. When they reached there they realised that though they were guests, they knew nothing about their hosts from any of the two families there. So they started inquiring and learned the following:
Ann and Marty have children Bill, Cathy and Frank.
Bill and Alice have no children.
Cathy and Don have children Matt and Sally.
Frank and Jill have a child Sarah.
Debbie and Phil have children Jill and Betty.
Jill and Frank have a child Sarah.
Betty and Paul have children Mary Jane and Bart.
Note: Both Families are Connected together by the marriage of Jill and Frank.
The Team now needs an Efficient Programmer who can design a software for them which would help them know which relatives are in some given relation with a particular member.
The first line of the data set for this problem is an integer which represents the number of data sets that follow. The first word in the data set is the relationship (SIBLING/PARENT/GRANDCHILD/GRANDPARENT)and the second word is the name of the person whose relative(s) is/are to be known.
Output the names of all who meet the relationship criterion.
All letters are upper cases.
The output is to be formatted exactly like that for the sample output given below.
Assumption: All letters are upper case.
Input: 1 SIBLING BART Output: MARY JANE
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, JAR, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions