Majestic Numbers#12419

Majestic Numbers

1 second
256 megabytes
Easy

You're given three integers and .

The majesticness of any positive integer is equal to the maximum integer that gives a positive integer value in this equation:

y = x^a \cdot b

Out of all the integer numbers in the range (l,r), find the one with the maximum majesticness, if multiple answers exist output the maximum one.

Input

The first line consists of a single integer (1 \le t \le 2 \cdot 10^5)the number of testcases.

Each testcase consists of three integers and (2 \le x \le 10^9 , 1 \le l \le r \le 10^9).

Output

The output consists of lines, each containing one value (the number with the maximum majesticness in the range (l,r), if multiple numbers satisfy the condition output the maximum one).

Examples

Example 1

Loading
Loading

Scoring

  • Subtask ( points): No additional constraints