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