#include <bits/stdc++.h>
using namespace std;
long long int x8[] = {1, 1, 1, 0, 0, -1, -1, -1};
long long int y8[] = {1, 0, -1, 1, -1, -1, 0, -1};
long long int x4[] = {1, -1, 0, 0};
long long int y4[] = {0, 0, 1, -1};
long long int mod = 1e9 + 7;
long long int inf = 1e18;
void getac() {
  long long int a, b;
  cin >> a >> b;
  if ((a + b) % 3 == 0) {
    long long int y = a - (a + b) / 3;
    long long int x = a - 2 * y;
    if (x >= 0 && y >= 0) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  } else {
    cout << "NO\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cerr.tie(NULL);
  ;
  long long int t;
  t = 1;
  cin >> t;
  while (t--) {
    getac();
  }
  cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms"
       << '\n';
  return 0;
}
