Van Gogh's Work Schedule

No attempts yetTime limit1sMemory limit64 MB

Problem

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=0t = 0.

When a customer arrives, Van Gogh writes down three values: the customer number CC, the time II until the next customer arrives, and the time SS needed to paint that picture. The first customer of a test case arrives at t=0t = 0, and every later customer arrives at the previous customer's arrival time plus the II the previous customer was given. An II of 00 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 SS hours after it starts.

Print the work schedule for the 2424 hours from hour 00 to hour 2323.

Input

The first line has the number of test cases nn (1n201 \le n \le 20).

Each test case spans several lines. A line holds three integers CC, II, SS separated by spaces: the customer number CC (1C1001 \le C \le 100), the time II until the next customer arrives (1I241 \le I \le 24), and the time SS needed for that customer's picture (1S101 \le S \le 10). On the line of the last customer, II is 00. A test case ends with a line where C=I=S=0C = I = S = 0. Every test case has at least one customer.

Output

For each test case print 2424 lines, one for every hour from 00 to 2323. 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 2424 or later do not appear in the schedule.

Print one blank line between test cases.