Grandparents and grandchildren

Working with trees, to use family terminology is frequent. Thus, is said
that a node is parent of another one, or child, or sibling, etcetera,
with the equivalent meaning as the tree was genealogical.

Write a program that reads various general trees, and for each one
prints all their relationships grandparent–grandchildren.

Input

Input is a sequence of general trees of words, with the format of the
exercise REREG. All the words of the same tree are different.

Output

For each given tree, your program must print all the relationships
grandparent–grandchildren in lexicogaphically order. Print a line in
white after the output of each tree. Follow the format of the instance.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:10:48.196Z

© Jutge.org, 2006–2026.
https://jutge.org
