#include <bits/stdc++.h>
using namespace std;
int main() {
  long long test = 1;
  cin >> test;
  while (test--) {
    long long n, m;
    cin >> n >> m;
    if (n >= 6 && n % m == 0) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
