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