#include <bits/stdc++.h>
using namespace std;
long long mod_exp(long long x, long long y, long long mm) {
  if (y == 0)
    return (1);
  else if (y % 2 == 0)
    return (mod_exp((x * x) % mm, y / 2, mm));
  else
    return ((x * mod_exp((x * x) % mm, (y - 1) / 2, mm)) % mm);
}
bool isPowerOfTwo(int n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
string solve() {
  int a, b;
  cin >> a >> b;
  int c = max(a, b);
  int d = min(a, b);
  a = c, b = d;
  if (a > 2 * b) return "NO";
  if (a == b && a % 3) return "NO";
  if (a == b) return "YES";
  int x = (a - b);
  if (b - x < 0) return "NO";
  if ((b - x) % 3 != 0) return "NO";
  if ((b - x) % 3 == 0) return "YES";
  return "YES";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cout << solve() << "\n";
  }
  return 0;
}
