#include <bits/stdc++.h>
using namespace std;
bool solve(long long a, long long b) {
  if (a == 0 && b == 0) return true;
  if ((a != 0 && b != 0) && (2 * a == b || 2 * b == a)) return true;
  long long dif = abs(a - b);
  if (min(a, b) - dif < 3)
    return false;
  else {
    if ((min(a, b) - dif) % 3 == 0)
      return true;
    else
      return false;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (solve(a, b))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
