#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const int mod = 998244353;
const int inf = 1e9 + 5;
const int N = 1e6 + 5;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    if (n % m)
      cout << "NO" << '\n';
    else
      cout << "YES" << '\n';
  }
  return 0;
}
