#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 2;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int ko;
  cin >> ko;
  long long a, b;
  while (ko--) {
    cin >> a >> b;
    if (a > b) swap(a, b);
    if ((2 * a) < b) {
      cout << "NO" << endl;
    } else if ((a + b) % 3 == 0) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
