#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, n, m;
  scanf("%lld", &t);
  for (long long int ca = 1; ca <= t; ca++) {
    scanf("%lld %lld", &n, &m);
    if (n == 3 || n == 4)
      printf("NO\n");
    else {
      if (n % m == 0)
        printf("YES\n");
      else
        printf("NO\n");
    }
  }
}
