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