Jams
Boondex has decided to improve its traffic jams coloring algorithm to be more consistent with drivers' expectations. For this purpose Boondex has collected drivers' feedback as a set of N integer pairs V_i, C_i where V_i is the speed of the driver's vehicle and C_i (C_i {0, 1, 2}) is the color that is expected to be seen on the map for this speed by this driver.
Please help Boondex find two integers A and B (0 ≤ A ≤ B) that will be used for their new traffic jams coloring algorithm. Traffic color will be considered to be color 0 if 0 ≤ V ≤ A, color 1 if (A+1) ≤ V ≤ B and color 2 if (B+1) ≤ V. Values A and B should be chosen to minimize the number of cases where traffic color from the new coloring algorithm is different from the driver's feedback. Among the possible combinations of A and B minimizing the number of such cases, the one with minimal value of (A+B) should be chosen as an answer.
Input
In the first line of input integer N is given - the total number of feedback pairs (1 ≤ N ≤ 10^5). On the next N lines of input integers V_i (0 ≤ V_i ≤ 10^6) and C_i (Ci {0, 1, 2}) are given - the driver's speed and expected trac color for that speed respectively.
Output
Print two integers A and B - the answer for this problem.