//法一:
#include<stdio.h>
#include<string.h>int a[2000002]={0};
int main()
{
int n,s,i,j;
for(i=2;i<2000002;i++)
for(j=i+i;j<2000002;j+=i)
a[j]+=i;
scanf("%d",&s);
while(s--)
{
scanf("%d",&n);
if(a[n]==0)
printf("Yes\n");
else
printf("No %d\n",a[n]+n+1);
}
return 0;
}
//法二:
#include<stdio.h>
int main()
{
int s;
scanf("%d",&s);
while(s--)
{
int n,sum=0,i;
scanf("%d",&n);
for(i=1;i*i<n;i++)
if(n%i==0)
sum+=i+n/i;
if(i*i==n)
sum+=i;
if(sum>n+1)
printf("No %d\n",sum);
else
printf("Yes\n");
}
return 0;
}