A favorite function
83% Success310 Attempts30 Points1.5s Time Limit256MB Memory1024 KB Max Code

Bob loves to factor numbers. His favorite function was \(f(x)\) which equal the number of divisors of \(x\).

For the birthday party, some friends came to Bob's house and each gift a pair of integers \(L\) and \(R\). Seizing the opportunity, the birthday boy began to entertain the guests as follows:

For each number \(x\) in the range \([L, R]\), he counted \(f(x)\). Then, he chose from these \(f(x)\)s the one that occurred to him the maximum number of times. And, at the top of his voice, he calls\( f(x)\) and how many times it occurred in this range.

If correct answers are \((a,\ b)\) and (c, d) that is \(a = b\) and \(b != d\), then print \(a\ b\) if b > d or print \(c\ d\) in other cases.

While the friends are having fun, try repeating Bob's trick yourself.

Input format

  • The first line contains \( T\) denoting the number of tests.
  • The next \(T\) lines contain each set of two integers \(L\) and \(R\).

Output format

For each test case, print two numbers denoting the value of \(f(x)\) and the number of such numbers.

Formally, let \(cnt(y) = |{x \in [L, R],\ f(x) = y}|\) and let \(mx\) be maximum value of \(cnt\) over all \(y's\) and \(y\) which is the largest possible \(y\) which \(cnt(y) = mx\), you should print \(y\div mx\).

Constraints

\(1≤T≤10\)

\(1≤L≤R≤5*10^6\)

Examples
Input
3
2 9
3 11
10 100
Output
2 4
2 4
4 30
Explanation

For the first 11 numbers:

f(1) = 1

f(2) = 2

f(3) = 2

f(4) = 3

f(5) = 2

f(6) = 4

f(7) = 2

f(8) = 4

f(9) = 3

f(10) = 4

f(11) = 2

For f(x) from numbers 2...9, the most common ones are those with two divisors (2,3,5,7).

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading Editor...
Results