#include <bits/stdc++.h>
using namespace std;
const int MOD = int(1e9) + 7;
const int INF = INT_MAX;
const long long INFF = INT64_MAX;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int moveX[] = {-1, 0, 1, 0};
const int moveY[] = {0, 1, 0, -1};
int gcd(int a, int b) {
  if (a == 0 || b == 0) return b;
  if (a == b) return a;
  if (a > b) return gcd(a - b, b);
  return gcd(a, b - a);
}
void go() {
  int n, m;
  cin >> n >> m;
  if (n < m) swap(n, m);
  if (n % m != 0) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) go();
  return 0;
}
