#include<cstdio>
#include<string>
#include<iostream>
#include<vector>
#include <algorithm>//fill()在里面
#include <cmath>
#include<queue>
#include<unordered_set>
#include<set>
#include <cstdlib>//貌似是free,malloc等函数的头文件
using namespace std;
const int INF=1e9; //fill(map[0],map[0]+maxn*maxn,INF);
const int maxn=110;
int main(){
int n;
string z;
//z的位数保证是偶数
scanf("%d",&n);
while(n--){
cin>>z;
//将z(k位数)切成两份(k/2位数)的数a,b 且a*b可以整除z
//判断输入的z满足上述条件就print yes,否则no
//分析:用string比较方便,直接从中间拆分,因为k保证是偶数
int number=stoi(z);
int len=z.length();
int a=stoi(z.substr(0,len/2));
int b=stoi(z.substr(len/2,len));
// cout<<"a="<<a<<"b="<<b<<endl;
int product=a*b;
if(product!=0&&number%product==0){//要有product!=0否则会报浮点错误
//如果能整除说明是因数
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
return 0;
}