Call Me Back, Please!

No attempts yetTime limit1sMemory limit128 MB

Problem

The call records a phone company keeps say nothing about what was said. They only say when a call started, how many minutes it ran, and which number called which. Even that much is enough to draw a network of who keeps in touch with whom.

A call runs from its start time for its duration, so it occupies the interval between its start time and its end time. Two numbers AA and BB are connected when you can pick one interval of 24 hours that both a call from AA to BB and a call from BB to AA reach into. Touching at a single instant counts as reaching in. Put another way, the two numbers are connected when the call that starts later begins no more than 24 hours after the call that starts earlier ends. Calls whose intervals overlap fall under this as well.

For example, AA calls BB for 20 minutes at 6:00am on 01/15, and BB calls AA for 1 minute at 6:20am on 01/16. The two numbers are connected, because the 24-hour interval from 6:20am on 01/15 to 6:20am on 01/16 reaches both calls. Had AA placed both calls, only one direction is covered, so that is not a connection. Had BB called back one minute later at 6:21am, that is not a connection either.

Read the whole list of calls and report every connection.

Input

The first line has the number KK of data sets. KK data sets follow, each in this form.

The first line of a data set has an integer nn, the number of calls (0n1000000 \le n \le 100000). Then come nn lines, one call per line.

yyyy/mm/dd hh:mm T <number1> <number2>

yyyy/mm/dd is the date the call started, with leading 0s where needed, and hh:mm is the start time, where the hour is in the 0-23 format. T is the duration of the call in minutes, an integer. <number1> is the number that placed the call and <number2> is the number that received it. Both are 10-digit numbers without any other characters, and the two numbers in one record are different.

The calls are sorted by the date and time at which they started, earliest first, and several calls may share the same start time.

Output

For each data set, print Data Set x: on a line by itself, where x is the number of the data set, counting from 1. Then print one line for every number that appears in the calls of that data set, in this form.

<number>: <conn1> <conn2> <conn3> ...

<number> is the number itself, and after the colon comes every number it is connected to. Sort the lines by increasing <number>, and sort the connections inside a line by increasing number as well. One space separates the colon from the first connection and one connection from the next. A number with no connection at all gets nothing after the colon.

Print a blank line after each data set.