#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long y = 2 * a - b;
    long long x = 2 * b - a;
    if (y >= 0 and x >= 0 and y % 3 == 0 and x % 3 == 0)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
