#include <bits/stdc++.h>
using namespace std;
void base() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (a * 2 < b)
      cout << "NO\n";
    else {
      int dif = b - a;
      if (a - dif >= 0 && b - 2 * dif >= 0 && (a - dif) % 3 == 0) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    }
  }
  return 0;
}
