Given ‘N’ events each with a ‘start’ and ‘end’ time in the form of intervals such that it represents a booking on the half-open interval [start, end), i.e., the range of real numbers x such that start <= x < end. Initially, the calendar has no events. A new event can be added to the calendar, if adding the event will not cause a triple booking. A triple booking happens when three events have some non-empty intersection (i.e., there exists a time common to all the 3 events).
Your task is to process the 'N' events, and for each of the events, add that event to the calendar and return ‘True’, if the event can be added to the calendar successfully without causing a triple booking. Otherwise, return ‘False’ and do not add that event to the calendar.
Input format:
The first line of input contains an integer ‘T’, denoting the number of test cases.
The first line of each test case contains an integer ‘N’, which represents the total number of events.
Then the next ‘N’ lines contain two space-separated integers 'Start' and 'End', denoting the starting and ending times of the 'N' intervals.
Output format:
For each test case, print 'N' space-separated 'True' or 'False' denoting the status of each event. (‘True’ if the addition of an event to the calendar does not cause triple booking, ‘False’ otherwise).
Output for each test case is printed on a separate line.
Note:
You do not need to print anything, it has already been taken care of. Just implement the given functions.
Constraints:
1 <= T <= 10
1 <= N <= 1000
0 <= Start , End <= 10^9
Time Limit: 1 sec