Limits 1s, 512 MB

As you know many IUPC's are knocking at the door and Jak realized he should do more practice of solving programming problems. As he is a busy person, after finishing his classes, projects, assignments, tuitions, coaching, dating he is able to manage a very little time for practice. In order to do well in the upcoming contests, he decided to make the best use of time and made a plan so that he can practice during the time gap between two classes.

Now, Jak eagerly wanted to know how much time he got to do practice before the next IUPC.

You will be given the number of class day(s) before next IUPC, the number of classes on a particular day and starting time and ending time of each class. Your task is to calculate the time Jak got to practice before next IUPC.

Input

The first line of input contains an integer NN (1N1041 ≤ N ≤ 10^4), the number of class days before the next IUPC. The next NN lines start with an integer MM (1M201 ≤ M ≤ 20), the number of classes on a particular day followed by MM pairs of time in the format HH:MM\text{HH:MM} (0HH230 ≤ \text{HH} ≤ 23, 0MM590 ≤ \text{MM} ≤ 59), the starting time and the ending time of each class.

Output

Print the total time Jak can practice by solving problems before the next IUPC in the format HH:MM\text{HH:MM}.

Samples

InputOutput
2
2 12:00 13:00 14:00 14:20
2 11:20 12:25 12:25 12:32
01:00

In the first example Jak has 2 class days before IUPC. The first day he has 2 classes, the first one starting at 12:00 and ending at 13:00. And, the next class starts at 14:00 and ends at 14:20. So for the first day Jak get 1 hour gap between the two classes. And as for the second day there is no gap between the two classes. So, the final answer is 01:00.

InputOutput
2
2 12:00 14:00 14:01 14:20
2 11:00 12:25 12:35 12:36
00:11

Submit

Login to submit.

Statistics

95% Solution Ratio
sarwarITEarliest, Apr '19
JoytunFastest, 0.0s
sarwarITLightest, 131 kB
SabbasachiSutradharShortest, 266B
Toph uses cookies. By continuing you agree to our Cookie Policy.