#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool isprime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a > b) {
      long long t = a;
      a = b;
      b = t;
    }
    if ((a * 2) == b) {
      cout << "YES\n";
    } else if (a * 2 < b) {
      cout << "NO\n";
    } else if (a == 1 && b == 1) {
      cout << "NO\n";
    } else {
      if ((a + b) % 3 == 0)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
  }
  return 0;
}
