Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Lets Make a Plan

Limits 1s, 512 MB

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

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.

Output

For each query, print Possible if the friends can meet. If they can not meet, print Oh no!, such a shame.

Samples

InputOutput
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
InputOutput
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


    Discussion
    Statistics

    100% Solution Ratio

    wahsinnige_F Earliest, 2w ago

    RamprosadG Fastest, 0.0s

    wahsinnige_F Lightest, 131 kB

    touhidur Shortest, 118B

    Submit

    Login to submit