Problem B
Braincutter's Association
Languages
en
is
Part of the video game Braincutter’s Association is keeping track of employees. There’s always a lot of new recruits and a similar number of employees who... are no longer fit to work. They have different levels of competence at various tasks and we boil that down to two numbers, their constitution and their discretion. When finding a suitable employee for a particular job it’s often necessary to keep one of these values constrained to a particular range of values. In this situation it can be good to know what range the other value will be constrained to as a result when considering all employees.
Input
The first line of the input contains one integer $1 \leq q \leq 10^5$. Next there will be $q$ lines, each with one query. Each line contains three integers $1 \leq t \leq 4$ and $1 \leq c, d \leq 10^9$. $t$ signifies the type of query. If $t = 1$ then an employee with constitution $c$ and discretion $d$ has begun working at the association. If $t = 2$ then an employee with constitution $c$ and discretion $d$ is no longer working with the association. Such an employee will always be present for this type of query. At the start the association will have no employees. If $t = 3$ then the program should print the lowest and highest discretion value of all employees who have their constitution value in the range $[c, d]$ on a single line with a space in between. If $t = 4$ the program should print the lowest and hightest constitution value of all employees who have their discretion value in the range $[c, d]$ in the same format.
Output
For each query of type $t = 3$ or $t = 4$ the lowest and highest values should be printed on its own line as described above. If there are no values satisfying the criteria the program should instead print ‘Enginn!’.
Sample Input 1 | Sample Output 1 |
---|---|
10 1 4 4 1 2 6 1 6 2 3 4 6 4 2 4 3 3 5 2 4 4 3 3 5 2 2 6 3 1 6 |
2 4 4 6 4 4 Enginn! 2 2 |