The exam season at University of Zagreb is over and students are doing what they love the most – sleeping. In the rare moments of wakefulness, they usually scroll over their Instagram feed. Fabijan is one of those students.
Recently, he read the following caption – the date
02.02.2020. is the first
palindromic date in the last ~909~ years.
He realized the caption was incorrect and this made him wonder about palindromic dates so he asked himself for each of the ~N~ dates what is the first palindromic date that comes after
that date. The date is considered palindromic if, when disregarding the dots, it is the same when read
from left-to-right as if it was read from right-to-left. For example, dates
are palindromic, while
12.07.1993. are not.
Note: In this task it is important to take account of leap years which have ~29~ days in February. For the purposes of this task, we consider a year to be a leap year if it is divisible by ~4~. Otherwise, months have ~31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30~ and ~31~ days in order.
The first line contains an integer ~N~ ~(1 \le N \le 10\,000)~ from the task description.
The next ~N~ lines contain a valid date in format
For each date from the input, you should output the first palindromic date that comes strictly after it.
That date should be printed in the
DD.MM.YYYY. and we guarantee that the solution exists in this format.
In the test cases worth a total of ~10~ points, each date in the output will have the same month and year as the corresponding date from the input. Also, ~N~ will be equal to ~10~.
In the test cases worth an additional ~10~ points, each date in the output will have the same year as the corresponding date from the input. Also, ~N~ will be equal to ~10~.
In the test cases worth an additional ~20~ points, ~N = 10~ will hold.
Sample Input 1
Sample Output 1
Explanation of Sample Output 1
Although the given date is palindromic, Fabijan is interested in
the first date that strictly comes after it. That date is
Sample Input 2
2 01.01.1000. 31.12.2026.
Sample Output 2
Sample Input 3
3 01.01.0100. 05.07.0321. 05.05.0505.
Sample Output 3
10.10.0101. 10.01.1001. 10.01.1001.