CODEIT03 - Play with Dates

no tags 

Given the date, month and year, find the day.

Input

The first line consists of an integer t, the number of test cases. Then for each test case there are three integers the day, month and year.

Output

For each test case print the day in words in a separate line (the first character should be capitalised followed by lowercase).

Constraints

1 ≤ t ≤ 100

Date/month/year ≥ 11/01/2012

Date/month/year ≤ 31/12/3000

The given date will always be a valid date.

Example

Input:
3
11 1 2012
12 1 2012
13 1 2012

Output:
Wednesday
Thursday
Friday

hide comments
sw2022: 2023-11-16 03:01:43

@cegprakash Isn't there any invalid date? I use the Kim Larson F/A and output none when the date is invalid such that 29 2 2013 cost me 1 WA... When I delete this special judge to invalid dates and my program output Friday for previous sample, it got AC. Therefore, please check the test case and figure out if there is any invalid date in it.

Added by myself: My program runs well in https://www.spoj.com/problems/CLOCK1/ , so I think you shouldn't doubt the correctness of the F/A or the program.

Reply by author: There is no test case with 29 as the date for February month in the judge. You can add a check for the same to verify this if you have an AC solution. I initially created a simple generator to avoid these issues.

Last edit: 2024-03-06 16:58:22
adityad1998: 2018-07-01 19:47:05

Read Zeller’s Congruence if you want a O(1) solution. Interesting method.

Tim Wargon: 2015-10-21 13:25:07

now i will never forget the logic behind leap years :) AC !

Ajay Pilaniya: 2015-08-23 01:04:59

Problem is easy but implementation is hard

anuveshkothari: 2015-07-27 13:24:25

same logic.. WA in java ..accepted in C++..

vasayashwanth: 2015-07-22 15:20:25

too easy....check for leap years....

Shubhransh Srivastav: 2015-07-12 19:27:23

http://www.spoj.com/submit/CODEIT03/id=14655301
wa always though getting test cases correct.. someone help plz :(

kp: 2015-06-24 14:50:36

after each WA .. got one tricky case :P AC :)

i_am_looser: 2015-05-31 09:52:27

Google it.... ;)

kartikay singh: 2015-05-24 06:47:02

_/\_ problem setter B-)


Added by:cegprakash
Date:2012-01-09
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All