Second International Programming Contest
March 28, 2004, Blagoevgrad, Bulgaria
Problem E

Lottery

In the country of Iusia is decided to make a lottery. That’s why the government needs a program to calculate the winning numbers. The president wants the winning numbers to have something in common with the hour, the minute and the second of the filling of the last slip. He has very eccentric minister in gambling who very likes binary numbers and operations with them, so he offers the way to calculate the winning numbers: you have to turn the hours, the minutes and the seconds in binary numbers, then execute on them XOR. The number that is the result of all that have to be turned into a decimal number again and is called “coefficient”. The nil number is 0 (it’s not a winning number). Every winning number is the previous one plus the coefficient.. Here the minister of the education (who is very smart mathematician) guesses that the winning numbers have to be limited, so when a number is bigger than the limit, the limit has to be extracted out the number. 
The only thing that left to be done is the program that makes all that calculations. So the president announced competition for a programmer, who must write the program. You are at this competition. Here are the conditions: you are given on the standard input n+1 rows. At the first row there is integer n – the number of the tests. The next n rows contain 4 numbers each – the hour (h), minutes (m), seconds (s) and the limiting number (l). (0<h<23, 0<m, s<59, 1<l<10000)
Your task is to print on the standard output n rows. In each row there has to be 11 numbers – the first is the coefficient; the next 10 are the first 10 winning numbers.

Example

Input:
1
7 9 5 9

Output:
11 2 4 6 8 1 3 5 7 9 2