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