#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a;
    int b;
    cin >> a >> b;
    float x = ((float)(2 * b - a)) / 3;
    float y = ((float)(2 * a - b)) / 3;
    if (x >= 0 && y >= 0 && floor(x) == ceil(x) && floor(y) == ceil(y))
      cout << "YES" << endl;
    else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
