#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class T>
using V = vector<T>;
using Graph = vector<vector<int>>;
using P = pair<long long, long long>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int q;
  cin >> q;
  while (q--) {
    long long a, b;
    cin >> a >> b;
    if ((a + b) % 3 == 0) {
      bool ok = 1;
      long long c = (a + b) / 3;
      if (a < c || b < c) ok = 0;
      if (ok) {
        cout << "YES" << endl;
      } else
        cout << "NO" << endl;
    } else
      cout << "NO" << '\n';
  }
}
