#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<string> res;
  for (int i = 0; i < t; ++i) {
    long long int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if ((a + b) % 3 == 0 && 2 * a >= b)
      res.push_back("YES");
    else
      res.push_back("NO");
  }
  for (int i = 0; i < t; ++i) {
    cout << res[i] << endl;
  }
}
