Raj and Simran are very close friends. They want to marry but Simran's parents are not ready. Simran's father is very superstitious and believes that wedding can only happen if they will ready to marry at a date given by him(dd mm yyyy format). Since Raj is a very busy person, he can't agree with this situation as he has to take a leave from his work. So Simran came through an idea that they will marry on the date that will consist of all the digits of the date given by his father with same occurrences i.e. only the positions of the digits alter. Since Simran has other jobs to do, you have to help her to find the nearest date(that comes after the date his father given to him) that can be formed by the digits that her father gave to her.
The first line contains an integer T denoting the number of test cases. Each test case contains three space-separated integers dd, mm & yyyydenoting day, month and year.
Output Format :
For each test case print, a single line containing three space-separated digits dd mm yyyythat comes after altering the date given by his father. If no date is possible, then print -1.
1. Consider every month will have exactly 30 days
2. dd and mm will always contain 2 digits if doesn't put a "0" ahead of them.
Explanation: Test case #1 :
If we change the positions of date 12 to 21 then it will be a valid date. Test case #2:
Switch day with the month and we will get the nearest valid date. Test case #3:
Since in a month we will have exactly 30 days so we cant change their relative positions and max value of yyyy is 9999, so we can't change it either.