#include <bits/stdc++.h>
using namespace std;
long long int fact(long long int n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return (n * fact(n - 1) % 1000000007) % 1000000007;
}
int prime(long long int n) {
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
long long int lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int i, j, k, n, sum, m = 0;
    cin >> n >> m;
    if (2 * n < m || 2 * m < n)
      cout << "NO"
           << "\n";
    else if (2 * n == m || 2 * m == n)
      cout << "YES"
           << "\n";
    else {
      if (n % 3 == 0 && m % 3 == 0)
        cout << "YES"
             << "\n";
      else if ((n % 3 == 1 && m % 3 == 2) || (m % 3 == 1 && n % 3 == 2)) {
        cout << "YES"
             << "\n";
      } else
        cout << "NO\n";
    }
  }
  return 0;
}
