For this Question: Swapnil is challenged to build a tower of a height greater than or equal to N. To build the tower he is given blocks of heights which are powers of 3. He can only use one type of block only once and is given infinite types of blocks. Help him make a tower of minimum height just greater than or equal to N.The first line of the input contains one integer T the number of tests. Then T test cases follow.
Each test case contains a single integer N.

<b>Constraints:-</b>
1 &le;  t &le; 100
0 &le;  N &le; 10<sup>18</sup>For each test case, print the height of the minimum possible tower greater than or equal to N.Sample Input
5
1
8
4
6
5

Sample Output
1
9
4
9
9

<b>Explanation:</b>
N=1 => use one brick of height 3<sup>0</sup>
N=8 => use one brick of height 3<sup>2</sup>
N=4 => use two bricks of heights 3<sup>0</sup> and 3<sup>1</sup>
N=6 => use one brick of height 3<sup>2</sup>. We can not use 2 bricks of the same type so can't use two bricks of height 3<sup>1</sup>., I have written this Solution Code: import math as m

def closestNum(n):
    val = m.log(n, 3)
    low = int(pow(3,int(val)))
    high = int(pow(3,int(val)+1))
    sumn = int((pow(3,int(val)+1)-1)//2)

    if(n > sumn):
        return high
    elif(n - low == 0):
        return low
    else:
        return low + closestNum(n-low);


t = int(input())
while(t > 0):
    n = int(input())
    print(closestNum(n))
    t = t-1, In this Programming Language: Python, Now tell me if this Code is compilable or not?