#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  int t;
  cin >> t;
  while (t--) {
    int a, b, x, y;
    cin >> a >> b;
    x = abs(a - b);
    y = min(a, b);
    y -= x;
    if (y >= 0 && y % 3 == 0) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
