#include <bits/stdc++.h>
using namespace std;
void faster() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  if (0) {
    freopen(
        "input"
        ".in",
        "r", stdin);
    freopen(
        "input"
        ".out",
        "w", stdout);
  }
}
int main() {
  faster();
  int t;
  long long a, b;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (2 * a >= b && 2 * b >= a && (2 * a - b) % 3 == 0 &&
        (2 * b - a) % 3 == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
