What 's wrong in my code?

INSPITE OF GETTING RIGHT ANSWER FOR GIVEN TEST CASES MY SUBMITTED ANS IS BEING SHOWN WRONG ,WHAT’S WRONG IN MY CODE OR THE TEST CASES I AM LEAVING

QUESTION LINK:https://www.codechef.com/LTIME66B/problems/EVENT

MY CODE LINK:https://pastebin.com/LazuMEXN

There is some problem with output format in your code like printf("\nmany") should be replaced by printf(“many\n”) and do not print any extra line like line no 41. Also, there is some problem with logic
Consider this test case
monday tuesday 9 9
output = impossible
answer = 9

//