t=int(input())
while(t>0):
  sum=0
  n=int(input())
  for i in range(1,n):
    if(n%i==0):
      sum+=i
  if(sum==n):
    print("true")
  else:
    print("false")
  t=t-1
t=int(input())
while(t>0):
  sum=0
  n=int(input())
  for i in range(1,n):
    if(n%i==0):
      sum+=i
  if(sum==n):
    print("true")
  else:
    print("false")
  t=t-1