#C5877. Delivery Scheduling
Delivery Scheduling
Delivery Scheduling
You are given several test cases. In each test case, there are several delivery requests represented by their start and end times. A delivery can be scheduled if its start time is not earlier than the finish time of the previous scheduled delivery.
In more formal terms, given a list of requests \( (s_i, e_i) \) for each test case, sort the requests by their end times in ascending order. Then, check if \( s_i \geq end \) for each delivery. If this condition holds for all requests, then the scheduling is \( \texttt{POSSIBLE} \); otherwise, it is \( \texttt{IMPOSSIBLE} \).
Your task is to determine for each test case whether all the deliveries can be scheduled without overlapping.
inputFormat
The input is given via standard input and is formatted as follows:
T N s1 e1 s2 e2 ... sN eN</p>... (repeated for the next test case)
Here, \( T \) (an integer) represents the number of test cases. Then for each test case, the first integer, \( N \), indicates the number of delivery requests, followed by \( N \) lines. Each of these lines contains two integers representing the start time and end time of a delivery request.
outputFormat
For each test case, output a single line. Print "POSSIBLE" if it is possible to schedule all deliveries without any overlap, and "IMPOSSIBLE" otherwise. The output is produced via standard output.
## sample2
3
1 4
2 5
5 8
4
2 3
1 2
3 4
4 5
IMPOSSIBLE
POSSIBLE
</p>