JAIHO - The Patriotic Indian

Everyone knows that Rajesh Koothrappali always keep complaining about the drawbacks of living in India. Some may not like living in their motherland, but that doesn't mean that they don't love it. Raj is one of them. So on one fine morning of 15.08.2014, Raj confesses that he really loves India and he misses it (Yes, there are no women in the room Tongue out). Sheldon is amused to hear this. He says to Raj, "No, you don't. You are just saying that because today is your country's 68th Independence day." Raj is piqued. Sheldon says, "Well, I can prove it. I will give you a date of the format "DD.MM.YYYY" where DD and MM is always 15 and 08 respectively. YYYY varies accordingly. You have to say if that date falls on the same day as that of India's independence day (15.08.1947) or not. Are you ready"? Raj doesn't want to lose. Though he is an astrophysicist, he is terrible at programming. So he asks for your help. Can you help Raj to prove him as a "Patriotic Indian"?

Input

The first line consists of an integer n, the number of test cases (1 <= n <= 1000). Each test case consists of a date of the format "DD.MM.YYYY" where DD is always 15 (denotes the 15th day), MM is always 08 (denotes the 8th month, August) and the value of YYYY is a four digit number, that is, 1000 <= YYYY <= 9999 which denotes the year.

Output

For each test case, output "Yes." if the given date falls on the same day as that of India's independence day (15.08.1947) or "No.", if it doesn't. And also as India got its independence only in 1947, if a year before 1947 is given in the input, checking for its validity is meaningless. So in such cases, print "Invalid.".

Example

Input:
4
15.08.1947
15.08.2015
15.08.1930
15.08.2014

Output:
Yes.
No.
Invalid.
Yes.
Explanation

Test case 3: As the given date 15.08.1930 is before India's independence (15.08.1947), the correct output will be "Invalid.".


Added by:mombassa
Date:2014-09-09
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Own

hide comments
2014-09-09 19:51:24 Jacob Plachta
Moved to Tutorial.
2014-09-09 18:46:47 Piyush Kaushik
My 50th :) .
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.