Divisors Again

For each of up to 10 ranges of at most 1001 integers, find the number in [L, U] with the most divisors.

Medium6Number theoryPrefix sumBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

Count the divisors of every integer in the range [L,U][L, U] and report the largest count. Both endpoints LL and UU belong to the range. A divisor count includes 1 and the number itself.

Input

The first line contains the number of ranges CC.

Each of the next CC lines contains the two endpoints LL and UU of one range, separated by a space.

Constraints

  • 1C101 \le C \le 10
  • 1LU1071 \le L \le U \le 10^7
  • 0UL10000 \le U - L \le 1000

Output

For each range, print one line with the largest divisor count found in that range.