Limits
1.5s, 512 MB

Sofdor Ali goes to Karwan Bazar every Thursday to eat Jilapi! But he often forgets what day is Thursday! In fact, he struggles to figure out the exact date for any day. He has an alarm clock in his pocket and it only rings at a specific time of the day. But this old clock does not give him information about the date. Sofdor has come up with a solution to this problem. Whenever he needs to know what day it is, he buys a newspaper. Newspapers always have dates written in it, and that solves Sofdor's problem. Well, at least for a day.

But buying newspapers is costly for Sofdor Ali, as he has to spend most of his money for buying important equipment for his experiment. So Sofdor is wondering, how he could reduce the cost of buying newspapers. Then he decided, he would buy a newspaper for one day and then calculate the next date from the newspaper's date. That will reduce the cost of buying newspapers to half, as Sofdor only has to buy one newspaper in two days.

Now you have to write a program that will help Sofdor Ali to calculate the date of the next day, once the current date is given.

The first line of the input is an integer `$T$`

(`$1 \le T \le 1000000$`

) denoting the number of test cases. Each of the next `$T$`

lines describe 3 integers `$D$`

(`$1 \le D \le 31$`

), `$M$`

(`$1 \le M \le 12$`

) and `$Y$`

(`$1900 \le Y \le 5000$`

) which denotes day, month and year.

You can safely assume that every date that is given as an input is a valid date.

For each date, print the next date in the following format:

```
Day Month, Year
```

Day must be formatted with a leading zero if it is less than 10. Month must be one of the following: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.

Input | Output |
---|---|

4 1 1 1993 20 10 1999 15 5 2009 11 11 1993 | 02 Jan, 1993 21 Oct, 1999 16 May, 2009 12 Nov, 1993 |

According to Wikipedia, a leap year can be identified in the following way:

If a year is not exactly divisible by 4 then it is a common year. Otherwise, if a year is not exactly divisible by 100 then it is a leap year. Otherwise, if a year is not exactly divisible by 400 then it is a common year. Else it is a leap year.

Login to submit.

60%
Solution Ratio

Ehsanul_FahadEarliest,

mdshadeshFastest, 0.2s

subhashis_cseLightest, 131 kB

steinumShortest, 354B

Toph uses cookies. By continuing you agree to our Cookie Policy.