#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int32_t tests;
  cin >> tests;
  for (int32_t test = 0; test < tests; test++) {
    int64_t a, b;
    cin >> a >> b;
    if (a < b) {
      swap(a, b);
    }
    if ((a + b) % 3 == 0 && 2 * a >= b && 2 * b >= a) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
