题目描述
Problem Description
In a long classroom, there are $n$ tables arranged in a row, each seating 2 students. The students are distracted because they are about to attend an art class, and their teacher plans to inspect them.
Each student has studied art to a certain level. The professor can tell how much they have learned by their facial expressions. The professor is an artist who uses different colored pencils for each grade. Unfortunately, today he only brought 1 pencil.
To make the exam appear fair, he wants to choose 2 tables and ask 1 student from each table between the chosen tables (including the chosen tables). It is important that all the students he questions receive the same score so that he can write it down with his single pencil.
The professor wants to know the maximum number of students he can inspect this way, and the score these students will receive.
Input Format
The input consists of $n+1$ lines.
The first line contains an integer $n$, as described in the problem.
The next $n$ lines each contain two integers: $a_i$ and $b_i$, representing the scores of the students sitting at table $i$.
Output Format
The output consists of one line.
The line contains 2 numbers separated by a space, representing the maximum number of students the professor can inspect and the score these students will receive.
If there are multiple solutions, output the one with the smallest score.
Sample Input and Output
Sample Input #1
1
1 5
Sample Output #1
1 1
Sample Input #2
3
3 5
4 5
1 3
Sample Output #2
2 5
Sample Input #3
4
2 1
3 2
5 3
2 5
Sample Output #3
2 2
Notes
Data Range
For $100\%$ of the data, $1 \le n \le 10^5$, $1 \le a_i, b_i \le 5$.
Notes
This problem is translated from COCI2010-2011 CONTEST #1 T2 PROFESOR.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分