#include<stdio.h>
int main()
{
int i, n, m;
int a[10] = {1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3991680};
scanf("%d",&n);
while (n--)
{
scanf("%d",&m);
for (i = 9; i >= 0; i--)
{
if (m >= a[i])
m-=a[i];
}
if (m == 0)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}