#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, m;
    cin >> n >> m;
    string ans;
    if (n == 3 || n == 4 || n == 5)
      ans = "NO";
    else {
      if (n % m == 0)
        ans = "YES";
      else
        ans = "NO";
    }
    cout << ans << endl;
  }
  return 0;
}
