#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    int mx = max(a, b), mn = min(a, b);
    if (mx - mn <= mn && (a + b) % 3 == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
