Van Gogh paints pictures for customers, and customers are served in the order they arrive. He has no job at the start and begins working at t=0.
When a customer arrives, Van Gogh writes down three values: the customer number C, the time I until the next customer arrives, and the time S needed to paint that picture. The first customer of a test case arrives at t=0, and every later customer arrives at the previous customer's arrival time plus the I the previous customer was given. An I of 0 means no further customer arrives.
Van Gogh paints one picture at a time. He finishes the current picture before starting the next one, and he paints in arrival order. Each picture therefore starts at the later of the customer's arrival time and the finish time of the previous picture, and it ends S hours after it starts.
Print the work schedule for the 24 hours from hour 0 to hour 23.
The first line has the number of test cases n (1≤n≤20).
Each test case spans several lines. A line holds three integers C, I, S separated by spaces: the customer number C (1≤C≤100), the time I until the next customer arrives (1≤I≤24), and the time S needed for that customer's picture (1≤S≤10). On the line of the last customer, I is 0. A test case ends with a line where C=I=S=0. Every test case has at least one customer.
For each test case print 24 lines, one for every hour from 0 to 23. A line holds four values joined with no separator: the hour, the number of the customer who arrives at that hour, the number of the customer whose picture Van Gogh starts at that hour, and the number of the customer whose picture is finished at that hour. Print - in a position where no such event happens. Arrivals, starts and finishes that fall at hour 24 or later do not appear in the schedule.
Print one blank line between test cases.