F. What Did I Do This Summer?
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Autumn has come — which means everyone starts thinking about how quickly summer flew by...

It seems that a lot happened over these three months — but at the same time, it feels like there could have been even more.

This time you prepared thoroughly — and documented all your activities, dividing them into four categories:

  • sleep;
  • study / work;
  • time on the road;
  • entertainment.

You are interested in the total time spent on each of the four categories of activities.

Input

The first line contains an integer $$$N$$$ ($$$1 \le N \le 2 \cdot 10^5$$$) — the number of records in the log.

Each of the next $$$N$$$ lines contains one log record in the format $$$D$$$ $$$A$$$ (two strings separated by a space), where:

  • $$$D$$$ — the date and time of the start of an activity in the format MM.DD hh:mm:ss — month, day, hour, minute, and second;
  • $$$A$$$ — the type of the activity that started, one of the characters:
    • S — sleep;
    • W — study / work;
    • T — time on the road;
    • R — entertainment.

It is guaranteed that:

  • the records are in strictly increasing chronological order;
  • the first record always contains the date and time 06.01 00:00:00 — the beginning of summer;
  • the date and time of each record are within the interval from 06.01 00:00:00 to 08.31 23:59:59 inclusive.

Note — consecutive records may contain the same activities.

Output

Output $$$4$$$ lines, each containing the total time spent on the corresponding activity type.

The order of the output lines is S, W, T, R (sleep; study / work; time on the road; entertainment, respectively).

Each line must be printed in the format DD hh:mm:ss — the number of days, hours, minutes, and seconds spent on that activity type over the whole summer.

Assume that summer ends exactly at 09.01 00:00:00 (that is, the last activity in the log continues until that moment).

Examples
Input
10
06.01 00:00:00 S
06.01 09:12:34 W
06.02 00:59:47 S
06.02 08:00:00 W
07.16 07:45:00 T
07.16 12:58:27 R
08.01 20:21:53 R
08.25 18:00:07 T
08.25 23:57:59 S
08.26 08:00:00 W
Output
S 1 00:14:48
W 50 07:32:13
T 0 11:11:19
R 40 05:01:40
Input
2
06.01 00:00:00 T
08.29 09:12:34 W
Output
S 0 00:00:00
W 2 14:47:26
T 89 09:12:34
R 0 00:00:00
Note

Example 1.

Let us consider the given log step by step:

  • at the beginning of summer, at midnight on June 1, you recorded that you were going to sleep;
  • on the same day you woke up at 09:12:34 and got to work;
  • you went to sleep again almost at 1 a.m. on June 2;
  • on June 2 you got up at 08:00:00 by alarm and went to work;
  • for a month and a half you forgot to fill in the log — that is, according to the log, you were working all that time;
  • finally, on July 16 you went on a trip — and recorded the start of the trip in your log;
  • on the same day at 12:58:27 you started having fun, also noting this in the log;
  • you remembered the log again only on August 1 — and again recorded the start of entertainment;
  • according to the log, you were having fun until the return trip on August 25 at 18:00:07;
  • after arriving home late in the evening, you immediately fell asleep (not forgetting to record the start of sleep in the log);
  • the next day you got up by alarm at 08:00:00 and went to work;
  • there were no more records, so you were working until the beginning of autumn — September 1 at 00:00:00.

Example 2.

Let us consider the given log step by step:

  • at the beginning of summer, at midnight on June 1, you were traveling somewhere;
  • after that, you forgot about the log for almost the whole summer;
  • you remembered it on August 29 — and recorded that you started working at 09:12:34.

Note that although there are no records of type S and R in the log — you still need to output the total time for them as well (in this case it will be zero, that is, 00 00:00:00).