You thought this contest was just an academic exercise, but it appears that the Gaelic curse placed upon you during the World Tour Contest was not broken, and took effect once again. (Or perhaps you didn't manage to break it, in which case you deserve what's coming next.)
You find yourself in some ancient time in the jungles on the Yucatán peninsula, and you meet a bunch of people you believe are Maya. Unfortunately, you do not understand a word of what they are saying to you. Fortunately, body language exists. And so you point at the sky, then at the sun, and make circular motions. They seem to understand that you wish to know the date, and so they draw some lines in the sand, giving you integers. It is now up to you to figure out the date, which you hope would bring you one step back to civilization and the modern era.
Input Specification
The first line will contain the integer , the number of lines that follows.
Each subsequent line will contain non-negative integers separated by spaces. Every integer will be in the range except for the second last, which will be in the range .
Output Specification
For each input line, output the date represented by the integers in ISO 8601 format using the Gregorian calendar on its own line. If the year contains less than 4 digits, it should be zero-padded until it has 4 digits.
Sample Input
2
7 16 6 16 18
12 19 19 17 19
Sample Output
-0031-09-01
2012-12-20
Comments