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