Problems
The ICPC World Finals are here and they are packed full of activities you want to attend — speeches, presentations, fun events, not to mention the contest itself. There is only one problem: when are you going to sleep?
When you fall asleep, you always set a timer because otherwise you would be able to sleep forever. Using the timer, you can choose to sleep for any positive integer amount of minutes. After sleeping for
You know the times of all the activities at the Finals; you should plan your sleep schedule to not miss any part of any event. Just before the Finals start (at minute
Input
The first line of input contains a positive integer n (
The
Output
If it is possible to find a sleep schedule that allows you to participate in all planned activities in their entirety, then output such a schedule in the format described below. Otherwise, output impossible.
A sleep schedule is specified by a line containing the number
The sleep periods must satisfy
If there are multiple valid sleep schedules, any one will be accepted. It can be shown that if there is a valid sleep schedule, then there is also one with at most
Example #1
3
30 45
60 90
120 180
2
0 30
90 120
Example #2
1
0 60
impossible
Example #3
7
31 32
35 41
48 55
69 91
1000 2022
2022 2023
2994 4096
5
0 5
10 28
56 68
92 900
2025 2900