q,*n=map(int,open(0).read().split()) for i in n: for j in range(1,40)[::-1]: k=int(pow(i,1/j)) if k**j==i: print(j) break