Ruby "200cm" Sun has a problem: she cannot reach the freezer section of her fridge! To assist her with the vertical challenge, she installed a retractable stepladder on the side of the fridge to help her reach the top.
Additionally, to improve at her chances of making CCO this year, she configured the stepladder to give her a programming challenge she needs to complete every time she wants to use it. However, yesterday she got a problem she didn't know how to solve. Can you help her solve it?
The problem is as follows:
There is a sequence of
numbers
. For a constant value
, define
as a sequence such that
. Can you select a constant
such that the MEX of
is maximized?
Note: the MEX of a sequence of non-negative integers
is defined as the smallest integer
such that
and
for all
.
Constraints
For all subtasks:
(
is the number of test cases)
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [20%]
Subtask 4 [60%]
No additional constraints.
Input Specification
The first line of input contains , the number of test cases. Next,
test cases follow.
The first line of each test case contains the integer .
The second line of each test case contains the integers .
Output Specification
For each test case, output two space separated integers: the maximum possible MEX of and the value of
that maximizes that MEX. If multiple values of
exist, output the smallest one.
The output of each test case should be on its own line.
Sample Input
1
5
11 4 5 23 10
Sample Output
2 4
Explanation
If we choose , then we get the sequence
which has a MEX of
(and it can be shown that the MEX will never be greater than
). While there are other values of
that give us a MEX of
,
is the smallest one of them.
Comments