#include <bits/stdc++.h>
using namespace std;
long long ll(long double x) { return x; }
int main() {
  int n;
  cin >> n;
  while (n--) {
    long long a, b;
    cin >> a >> b;
    if (ceil((2 * a - b) / 3.0) == floor((2 * a - b) / 3.0) and
        ceil((2 * b - a) / 3.0) == floor((2 * b - a) / 3.0) and
        ceil((2 * b - a) / 3.0) >= 0 and ((2 * a - b) / 3.0) >= 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
