T = int(input())
for tc in range(1, T+1):
lst = []
N = int(input())
for i in range(1, N+1):
if N % i == 0:
lst.append(i)
for j in lst:
if 1 <= j <= 9:
if 1 <= N // j <= 9:
print('#{} Yes'.format(tc))
break
else:
print('#{} No'.format(tc))
break