#include <bits/stdc++.h>
using namespace std;
long long n, a, b, i;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    if ((a + b) % 3 == 0 and a * 2 >= b)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
