#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using db = double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
using vi = vector<int>;
using vl = vector<ll>;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long a, b;
    cin >> a >> b;
    if (((a % 3 + b % 3) % 3 == 0) && (b <= 2 * a && a <= 2 * b)) {
      cout << "YES\n";
    } else
      cout << "NO\n";
  }
  return 0;
}
