It’s not easy to hang out with your friends during weekends when you have a full-time job and bills to pay, not to mention you both live in the two opposite sides of the town and have different weekend breaks. Our friends Tom and John are going through the same hurdle, as they decide to make a plan. But wait, there is a problem! The companies that Tom and John work at, have weekends at different dates. Can you help them find if they are available in the same weekend?
Input starts with T ( 1 <= T <= 500), number of test cases to follow.
Each test case contains, one line. Every line contains four strings, the weekends that Tom and John have in their company. The first two strings are the weekends that Tom has while the third and the fourth string represents John’s weekend.
For each query, print Possible if the friends can meet. If they can not meet, print Oh no!, such a shame.
Input | Output |
---|---|
5 Monday Thursday Monday Tuesday Friday Sunday Tuesday Thursday Thursday Friday Friday Saturday Monday Sunday Saturday Saturday Wednesday Thursday Monday Sunday | Possible Oh no!, such a shame Possible Oh no!, such a shame Oh no!, such a shame |
Input | Output |
---|---|
5 Monday Wednesday Tuesday Sunday Saturday Saturday Monday Sunday Friday Sunday Friday Sunday Monday Thursday Wednesday Saturday Thursday Saturday Wednesday Wednesday | Oh no!, such a shame Oh no!, such a shame Possible Oh no!, such a shame Oh no!, such a shame |