#include <bits/stdc++.h>
using namespace std;
struct _in {
  inline operator char() {
    char c = getchar_unlocked();
    getchar_unlocked();
    return c;
  }
  inline operator double() {
    double d;
    scanf("%lf", &d);
    getchar_unlocked();
    return d;
  }
  template <typename T>
  inline operator T() {
    T n{}, m{1}, c;
    while (isspace(c = getchar_unlocked()))
      ;
    if (c == '-') m = -1, c = getchar_unlocked();
    do {
      n = 10 * n + (c - '0'), c = getchar_unlocked();
    } while (c >= '0' && c <= '9');
    return m * n;
  }
} in;
template <typename T>
inline bool scan(T &o) noexcept {
  int c{getchar_unlocked()};
  return c == EOF ? false : (ungetc(c, stdin), o = in, true);
}
template <typename H, typename... T>
inline bool scan(H &h, T &&...t) noexcept {
  return scan(h) && scan(t...);
}
inline void out(bool b) noexcept { putchar_unlocked('0' + b); }
inline void out(const char *s) noexcept {
  while (*s) putchar_unlocked(*s++);
}
inline void out(char c) noexcept { putchar_unlocked(c); }
template <typename T>
inline void out(T n) noexcept {
  static char b[20];
  char *p = b;
  T m = n < 0 ? putchar_unlocked('-'), -1 : 1;
  if (!n)
    *p++ = '0';
  else
    while (n) *p++ = (char)(n % 10 * m + '0'), n /= 10;
  while (p != b) putchar_unlocked(*--p);
}
inline void outl() noexcept { out('\n'); }
template <typename H, typename... T>
inline void out(H &&h, T... t) noexcept {
  out(h);
  out(t...);
}
template <typename... T>
inline void outl(T... t) noexcept {
  out(t...);
  outl();
}
struct range {
  int e, b = 0, s = 1;
  range(int b, int e, int s) : e(e), b(b), s(s) {}
  range(int b, int e) : e(e), b(b) {}
  range(int e) : e(e) {}
  struct it {
    int v, s;
    it(int v, int s) : v(v), s(s) {}
    operator int() const { return v; }
    inline operator int &() { return v; }
    int operator*() const { return v; }
    inline it &operator++() {
      v += s;
      return *this;
    }
  };
  it begin() { return {b, s}; }
  it end() { return {e, s}; }
};
int main() {
  for (int t = in; t; t--) {
    int n{in}, m{in};
    outl(n % m ? "NO" : "YES");
  }
}
