#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long int a, b;
    scanf("%lld %lld", &a, &b);
    if (((a - (b + b - a) / 3) % 2 == 0) && ((b + b - a) % 3 == 0) &&
        (b + b - a) >= 0 && (a - (b + b - a) / 3) >= 0) {
      printf("YES\n");
    } else {
      swap(a, b);
      if (((a - (b + b - a) / 3) % 2 == 0) && ((b + b - a) % 3 == 0) &&
          (b + b - a) >= 0 && (a - (b + b - a) / 3) >= 0) {
        printf("YES\n");
      } else {
        printf("NO\n");
      }
    }
  }
  return 0;
}
