#include<iostream>//baoli kankan nengfou ya suo
#include<cstdio>
using namespace std;//工藤新一 真人版第7集 (应该是)
int main() //表面上无规律实际上有的只要在2-2k之间有可以整除n的就行
{
freopen("tstones.in","r",stdin);
freopen("tstones.out","w",stdout);
int t;
unsigned long long n,k;
cin>>t;
for(int i=1;i<=t;i++)
{//di yi ci ruguo
cin>>n>>k;
if(n%(k+1)==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}