#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int test;
  cin >> test;
  while (test--) {
    int a, b, x, y;
    cin >> a >> b;
    if (a < b) swap(a, b);
    bool ok = 1;
    x = 2 * a - b;
    if (x % 3 != 0) ok = 0;
    y = x / 3;
    if ((a + b) % 3 != 0) ok = 0;
    x = (a + b) / 3 - y;
    if (x < 0 || y < 0) ok = 0;
    cout << (ok ? "YES\n" : "NO\n");
  }
  return 0;
}
