#include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
  long long a, b;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    long long m = abs(a - b);
    if (a == b) {
      if (a % 3 == 0) {
        cout << "YES"
             << "\n";
        continue;
      } else {
        cout << "NO"
             << "\n";
        continue;
      }
    }
    long long x, y;
    x = min(a, b) - m;
    y = max(a, b) - 2 * m;
    if (m > min(a, b)) {
      cout << "NO"
           << "\n";
      continue;
    }
    if (x % 3 == 0)
      cout << "YES"
           << "\n";
    else
      cout << "NO"
           << "\n";
  }
  return 0;
}
