Given . You can perform 3 types of operations:
You have to find the minimum number of operations needed to reach 1.
The first line of the input will contain an integer (), the number of test cases. Each of the next T lines will contain an integer (), as described in the problem statement.
For each test case, you have to find the minimum number of operations needed to reach 1.
Input | Output |
---|---|
5 2 3 4 5 23 | 1 2 2 3 6 |