Jadie Wadie's Racie Pacie


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python, Rust

Jaiden has just finished the City2Surf running race, but he is disappointed with his time! Luckily for him, he has managed to break into their database and is able to modify his result. As to not raise suspicion, he cannot add or remove any digits in his time, he can only rearrange the digits in the displayed time. In addition, the edited time must be a valid time and also have no leading zeroes in the hours part of the time. A valid time has both its minutes and seconds between 0 and 59, inclusive.

For example, if Jaiden finished with a time of 1:07:20 - that is, 1 hour, 7 minutes, and 20 seconds, 2:17:00 and 1:02:07 are valid rearrangements, but 0:00:27 (leading zeroes), 1:00:72 (invalid time format), and 1:23:45 (not the same digits) are invalid rearrangements.

Help Jaiden rearrange his time to get the best possible time! The best possible time minimises the time lexicographically: it minimises hours first, then minutes, then seconds.

Input

The first line and only line consists of an integer h, and two strings of exactly two decimal digits m and s, representing the hours, minutes, and seconds fields of Jaiden's time. This means the minutes and seconds fields may have leading zeros. It is guaranteed that 1 \leq h \leq 10^6, and that the input forms a valid time.

Output

Output the best possible rearranged time, separated by spaces in the format above (i.e. hours, minutes, seconds, where hours is an integer with no leading zeros, and minutes and seconds are two-digit padded numbers).

Examples

Input 1
1 07 20
Output 1
1 00 27
Input 2
9 59 59
Output 2
9 59 59
Input 3
100 21 21
Output 3
100 11 22

Comments

There are no comments at the moment.