I have been using python for a while now and I am quite comfortable using it, but I have encountered a really weird problem, for some reason when I try to input a large number and use int() to convert it to integer the number is always off. This is a code for a codeforces problem, the logic is correct but for some reason if I input n=99999999999999999, what happens is that n will equal 10^18. I am assuming it's an approximation by python, how can I avoid that ?
t=int(input())
for _ in range(t):
    n=int(input())
    if n<10:
        print(n)
    else:
        flag=True
        while flag:
            for i in range(int(math.log10(n))+1):
                digit=n%(10**(i+1))//(10**i)
                if digit==0:
                    continue
                if not (n%digit==0):
                    break
                if i==int(math.log10(n)):
                    print(n)
                    flag=False
            n+=1   
 
     
    