#P1512. 伊甸园日历游戏

伊甸园日历游戏

Description

Adam and Eve play a game that starts from a date chosen uniformly at random from 1900.1.11900.1.1 to 2006.11.32006.11.3. They then take turns applying one of the following operations to the current date:

  1. Add 11 to the day. For example, 1900.1.11900.1.1 becomes 1900.1.21900.1.2.
  2. Add 11 to the month. For example, 1900.1.11900.1.1 becomes 1900.2.11900.2.1.

If the day exceeds the number of days in the current month, the date rolls over to the 11st day of the next month. If the month exceeds 1212, it rolls over to January of the next year. Moreover, when performing operation 2, if the resulting date would be invalid (for example, 1900.1.311900.1.31 becoming 1900.2.311900.2.31), the operation is illegal and not allowed. All operations must respect calendar rules, including leap years.

Whoever first changes the date to exactly 2006.11.42006.11.4 wins. If you overshoot the specified date, it does not count as a win.

Adam always moves first. For the given starting date, determine whether he has a winning strategy.

Input Format

  • The first line contains an integer TT, the number of test cases.
  • Each of the next TT lines contains three integers XX, YY, ZZ, indicating year XX, month YY, and day ZZ.

Output Format

For each test case, output YES or NO indicating whether Adam has a winning strategy.

3
2001 11 3
2001 11 2
2001 10 3

YES
NO
NO

Hint


2024/1/31 Added a set of hack testdata.

Translated by ChatGPT 5