#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long int t;
  cin >> t;
  for (int q = 0; q < t; q++) {
    long long int a, b;
    cin >> a >> b;
    if (a > (2 * b) || (2 * a) < b) {
      cout << "NO" << endl;
    } else {
      if ((2 * a - b) % 3 == 0 && (2 * b - a) % 3 == 0)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
