You are given a number N. You can perform the following operations on N any number of times:
> If N is even, divide N by 2.
> If N is odd, replace N with 3N+1.
Your task is to find out, for a given N, if it is possible to reach the number 1 after performing the above two valid operations on N any number of times.
- First-line contains T denoting the number of test cases.
- Next T lines contain just one integer, N.
Print “YES” (without the quotes) if it is possible to reach 1 for the given N. Else print “NO”(without quotes).
1<= T <=100
2<= N <= 10100,000
The steps are:
21 –> 64 –> 32 –> 16 –> 8 –> 4 –> 2 –> 1.
Here if we take any even number and start dividing by 2 then at last we will get 1 for all number . similarly if we take a odd then we have to change it in (3*n+1) according to question and after this process it become a even number and when we start dividing it by 2 then we will get 1.
So we have to print “YES” in all cases.