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