#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
bool work() {
  int a = read(), b = read();
  if (a > b) swap(a, b);
  if (a == 0) return (b == 0);
  if (a * 2 < b) return 0;
  if (a * 2 == b) return 1;
  int c = (abs(b - a - a));
  return (a + b) % 3 == 0;
}
signed main() {
  int n = read();
  while (n--)
    if (work())
      puts("YES");
    else
      puts("NO");
  return 0;
}
