from functools import cache @cache def p(x,y): return x**y T=int(input()) for _ in range(T): n=int(input()) for k in reversed(range(2,40)): ok=0 ng=10**6 while ng-ok>1: m=(ok+ng)//2 if p(m,k)<=n: ok=m else: ng=m if ok**k==n: print(k) break else: print(1)