#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> n >> m;
    int j = n % m;
    switch (j) {
      case 0:
        cout << "YES" << endl;
        break;
      default:
        cout << "NO" << endl;
    }
  }
  return 0;
}
