시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB28171275.000%

문제

Marie is travelling on a long journey to a far away land by foot. She moves at different speeds at different times of the year due to different weather patterns. More specifically, she can move 3 miles a day during the hot season of January through April, 5 miles a day during the warm season of May through August, and 1 mile per day during the cold season of September through December. Given a starting date, and the distance Marie must travel, calculate when Marie will reach her destination.

입력

The first line of input will contain a single integer n that indicates the number of datasets to follow.

Each dataset will be composed of:

  • An integer d between 1 and 12000, which is the distance Marie must travel.
  • A date in the format “m d, y”, where m, d, and y are the month, day of the month, and year, respectively, on which Marie begins her journey. All dates will be valid.

출력

Output the valid date that Marie will arrive at her far away destination in the format “m d, y”, where m, d, and y are the month, day of the month, and year, respectively.

예제 입력 1

3
1000
January 1, 1999
365
August 12, 2034
712
December 31, 1991

예제 출력 1

September 26, 1999
February 17, 2035
July 09, 1992