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 ~n~ 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.
The first line will contain the integer ~N~ ~(0 \le N \le 1000)~, the number of lines that follows.
Each subsequent line will contain ~n~ ~(5 \le n \le 13)~ non-negative integers separated by spaces. Every integer will be in the range ~[0, 20)~ except for the second last, which will be in the range ~[0, 18)~.
For each input line, output the date represented by the ~n~ 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.
2 7 16 6 16 18 12 19 19 17 19