//KZNS
#include <cstdio>
using namespace std;
typedef unsigned long long ull;
inline ull input() {
char c = getchar();
ull ans = 0;
while (!('0' <= c && c <= '9'))
c = getchar();
while ('0' <= c && c <= '9') {
ans = ans * 10 + c - '0';
c = getchar();
}
return ans;
}
int main() {
freopen("tstones.in", "r", stdin);
freopen("tstones.out", "w", stdout);
int T;
scanf("%d", &T);
ull N, K;
while (T--) {
N = input();
K = input();
if (N % (K+1))
printf("NO\n");
else
printf("YES\n");
}
return 0;
}
//UBWH