Polycarp has a strict daily schedule. He has *n* alarms set for each day, and the *i*-th alarm rings each day at the same time during exactly one minute.

Determine the longest time segment when Polycarp can sleep, i. e. no alarm rings in that period. It is possible that Polycarp begins to sleep in one day, and wakes up in another.
The first line contains a single integer *n* (1 ≤ *n* ≤ 100) — the number of alarms.

Each of the next *n* lines contains a description of one alarm. Each description has a format "hh:mm", where *hh* is the hour when the alarm rings, and *mm* is the minute of that hour when the alarm rings. The number of hours is between 0 and 23, and the number of minutes is between 0 and 59. All alarm times are distinct. The order of the alarms is arbitrary.

Each alarm starts ringing in the beginning of the corresponding minute and rings for exactly one minute (i. e. stops ringing in the beginning of the next minute). Polycarp can start sleeping instantly when no alarm is ringing, and he wakes up at the moment when some alarm starts ringing.
In the first example there is only one alarm which rings during one minute of a day, and then rings again on the next day, 23 hours and 59 minutes later. Polycarp can sleep all this time.
1
05:43
23:59
4
22:00
03:21
16:03
09:59
06:37
20
23:59
00:00
00:01
00:02
00:03
00:04
00:05
00:06
00:07
00:08
00:09
00:10
00:11
00:12
00:13
00:14
00:15
00:16
00:17
00:18
23:40
21
23:28
23:29
23:30
23:31
23:32
23:33
23:34
23:35
23:36
23:37
23:38
23:39
23:40
23:41
23:42
23:43
23:44
23:45
23:46
23:47
23:48
23:39
2
00:00
23:59
23:58
2
01:00
01:01
23:58
3
01:00
01:01
01:02
23:57
2
06:25
22:43
16:17
2
05:53
04:15
22:21
2
11:24
13:53
21:30
3
22:50
11:46
22:36
12:55
4
10:00
15:30
03:48
11:46
12:17
5
01:40
08:08
14:58
18:54
17:52
06:49
6
04:05
03:46
18:53
04:07
22:58
08:49
10:03
7
22:26
21:15
14:57
08:27
19:31
13:51
14:21
10:00
8
15:52
06:02
13:08
06:18
21:54
05:02
22:56
00:10
06:49
9
01:38
15:16
18:50
00:45
17:26
16:30
09:10
00:46
05:49
06:05
10
01:01
04:46
12:17
04:37
19:20
10:46
12:50
03:17
23:50
19:13
06:22
20
14:59
00:52
15:39
08:40
12:49
15:15
13:17
14:29
11:43
14:39
08:57
12:53
17:38
11:23
07:53
12:58
00:29
06:20
05:20
23:59
06:20
31
21:46
16:36
19:00
03:43
07:33
16:16
22:08
16:27
14:25
18:43
14:32
13:15
13:27
06:13
22:34
09:39
11:55
12:33
17:39
00:49
09:51
07:38
00:42
00:57
01:40
08:06
16:39
12:13
12:15
08:38
14:24
02:45
40
22:10
12:46
13:20
14:31
23:38
15:42
15:53
13:28
00:03
13:01
10:44
18:42
12:35
18:50
19:35
05:11
02:29
05:00
06:06
18:05
08:09
07:02
14:51
15:14
09:48
05:07
04:53
06:19
00:18
08:02
15:08
11:17
00:59
00:30
01:17
07:23
10:20
03:54
16:55
05:25
02:34
50
21:58
09:10
01:27
20:25
12:48
20:44
23:13
08:44
14:55
05:58
09:30
01:54
04:15
14:25
12:22
13:37
06:18
20:07
00:40
19:11
15:06
15:49
01:40
17:53
01:04
19:54
00:31
22:25
07:52
10:25
11:52
13:24
06:52
08:42
00:42
15:09
09:58
16:25
23:31
11:26
11:43
00:59
10:08
07:42
00:39
14:35
08:00
16:04
01:01
03:19
01:42
60
17:21
17:49
12:33
03:42
16:16
16:21
22:06
19:51
14:52
03:23
08:16
13:11
19:16
04:13
12:22
07:27
07:09
22:47
20:21
10:10
19:52
17:53
15:45
09:13
18:36
04:10
03:59
23:08
19:30
09:36
18:58
01:34
14:25
12:43
19:12
03:05
04:25
03:48
04:14
03:38
02:29
07:17
19:06
18:47
12:24
16:45
21:40
11:33
07:52
02:24
01:00
20:37
21:20
16:04
20:24
05:18
00:57
23:02
18:56
16:40
01:50
70
03:33
23:36
03:16
18:18
06:36
06:58
17:27
04:07
14:39
15:53
17:09
05:16
20:28
09:34
02:41
14:18
20:00
04:14
00:25
20:18
16:34
10:13
21:45
11:08
16:19
20:50
03:08
05:06
02:08
02:51
15:16
11:02
18:13
18:35
00:04
08:50
06:12
20:16
12:05
04:01
08:38
03:57
22:44
04:28
04:37
10:32
18:02
15:04
10:31
07:28
13:55
15:15
09:08
19:54
04:18
04:29
10:00
13:47
02:14
23:15
22:11
21:17
20:51
05:46
00:17
01:59
19:41
02:37
03:00
19:14
01:41
def formatted_number(number):
	if (number < 10):
		return "0" + str(number)

	return str(number)


def print_max_duration(time):
	hh = time // 60
	mm = time - hh * 60

	print(formatted_number(hh)+":"+formatted_number(mm))


def parse_minutes(time):
	hh = int(time[0:2])
	mm = int(time[3:])
	return hh * 60 + mm

def main():
	n = int(input())

	arr = []

	for i in range(n):
		arr.append(parse_minutes(input()))

	arr = sorted(arr)

	max_duration = 0
	for i in range(n - 1):
		max_duration = max(max_duration, arr[i + 1] - arr[i] - 1)

	max_duration = max(max_duration, (24 * 60 - arr[n - 1] - 1) + arr[0])
	print_max_duration(max_duration)



if __name__ == "__main__":
	main()