Repeated Josephus#1515

Repeated Josephus

1 second
128 megabytes
Very easy

There are initially people arranged in a circle and numbered from to . Starting from the first person, every second remaining person is eliminated until only one person remains. Let the number of the survivor be . Then, the process is repeated with people arranged in a circle and numbered from to . Let the survivor's number in this round be . The process continues in this way, each time with the survivor's number as the new circle size. The process stops when the survivor’s number is equal to the number of people in the current round.

Consider the example where n = 5: after the first round, the survivor is person . Because is not equal to , a new round is started with people. In this round, person survives again. Now the survivor's number equals the number of people, so the process stops.

Input

The first line contains the number of test cases. Each test case consists of a line containing the integer (0 < n \leq 30000).

Output

For each test case, output its number, a colon, a space, the total number of repetitions (the number of rounds conducted after the first round with people), a space, and the survivor's number in the last round.

Examples

Example 1

Loading
Loading