logo AlgoBeat OnlineJudge
登录 注册

#214151. [SDCPC 2019] Calandar

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

On a planet far away from Earth, one year is composed of 12 months, and each month always consists of 30 days.

Also on that planet, there are 5 days in a week, which are Monday, Tuesday, Wednesday, Thursday and Friday. That is to say, if today is Monday, then tomorrow will be Tuesday, the day after tomorrow will be Wednesday. After 3 days it will be Thursday, after 4 days it will be Friday, and after 5 days it will again be Monday.

Today is the -th day in the -th month of year . Given the day of today on that planet, what day will it be (or was it) on the -th day in the -th month of year on that planet?

输入格式

There are multiple test cases. The first line of the input contains an integer (about 100), indicating the number of test cases. For each test case:

The first line contains three integers , , (, , ) and a string , indicating the date and day of today on that planet. It's guaranteed that is either Monday, Tuesday, Wednesday, Thursday or Friday.

The second line contains three integers , and (, , ), indicating the date whose day we want to know.

输出格式

For each test case output one line containing one string, indicating the day of the -th day in the -th month of year on that planet.

样例

样例输入 1

4
2019 5 12 Monday
2019 5 14
2019 5 12 Tuesday
2019 12 30
2019 5 12 Friday
1000000000 1 1
1000000000 1 1 Wednesday
2019 5 12

样例输出 1

Wednesday
Friday
Thursday
Thursday