Today is Ted's 100th birthday. A few weeks ago the family chose you to track down all of Ted's descendants and throw a surprise party. To make the job easier, you decide to build a single list of everyone descended from Ted, ordered from oldest to youngest. Descendants who are the same age are listed in dictionary order.
The only records you have are birth certificates. Strangely, none of them are dated. Each certificate lists only three things: the father's name, the child's name, and the father's exact age (in whole years) at the moment the child was born.
Because every descendant of Ted shares Ted's birthday, the age gap between any two people is always a whole number of years. Ted turns 100 today, so his age is 100.
The first line contains a single integer $n$, the number of data sets. Each data set is formatted as follows.
A data set has two parts:
FNAME CNAME FAGE, where:
FNAME is the father's name.CNAME is the child's name.FAGE is the father's whole-year age on the day CNAME was born.Notes:
For each data set, print $X + 1$ lines. The first line is DATASET Y, where $Y$ is $1$ for the first data set, $2$ for the second, and so on. The next $X$ lines are the age-prioritized list of Ted's descendants, one per line in the format NAME AGE, ordered from oldest to youngest. Descendants of the same age are listed in dictionary order.