#include <bits/stdc++.h>
using namespace std;
vector<int> pr;
int x[1000002] = {0};
long long int m = 1000000007;
long long int me(long long int a, long long int b) {
  int res = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) res = (res * a) % m;
    a = a * a;
    b = b >> 1;
  }
  return res;
}
int main() {
  int t;
  cin >> t;
  for (int y = 0; y < t; y++) {
    long long int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if ((a + b) % 3 == 0 && (2 * a >= b))
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
